diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000000000000000000000000000000000000..2ec9bc11a1998f14574cb5d4ba2776c40c405cf2 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,22 @@ + + +pylint_config = """ +[MASTER] +ignore-patterns= +disable=C0111,C0103 + +[FORMAT] +max-line-length=100 + +[MESSAGES CONTROL] +disable=missing-docstring,invalid-name + +[DESIGN] +max-args=4 +max-attributes=7 +""" + +with open('.pylintrc', 'w') as config_file: + config_file.write(pylint_config) + +print("Pylint configuration file created at project root.") \ No newline at end of file diff --git a/flaskapp.py b/flaskapp.py index 3ab157d3bc09ab203c63a3cf51a4e0a82b1fd429..7c2c63acf07b4a14e311059deeccf72052b6d54b 100644 --- a/flaskapp.py +++ b/flaskapp.py @@ -1,4 +1,5 @@ -# Write a python code which creates a server which guesses a number between 1 and 11, and then responds to https requests to say if they got the guess right or wrong. +# Write a python code which creates a server which guesses a number between 1 and 11, and then +# responds to https requests to say if they got the guess right or wrong. # It should be a server that can handle http requests and understand json data. import random @@ -9,7 +10,6 @@ app = Flask(__name__) # Generate a random number between 1 and 11 secret_number = random.randint(1, 21) - @app.route('/guess', methods=['POST']) def guess_number(): data = request.get_json() @@ -24,8 +24,8 @@ def guess_number(): if user_guess == secret_number: return jsonify({"result": "Correct! You guessed the right number."}), 200 - else: - return jsonify({"result": "Wrong guess. Try again!"}), 200 + + return jsonify({"result": "Wrong guess. Try again!"}), 200 if __name__ == '__main__':