Skip to content
Snippets Groups Projects
Commit 6446061d authored by Clancy Turlagh's avatar Clancy Turlagh
Browse files

Merge branch 'issue-fixing' into 'main'

issue fixed

See merge request !3
parents b75bd16d e97ab95c
No related branches found
No related tags found
1 merge request!3issue fixed
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
# 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__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment