# 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.
importrandom
...
...
@@ -9,7 +10,6 @@ app = Flask(__name__)
# Generate a random number between 1 and 11
secret_number=random.randint(1,11)
@app.route('/guess',methods=['POST'])
defguess_number():
data=request.get_json()
...
...
@@ -24,8 +24,8 @@ def guess_number():
ifuser_guess==secret_number:
returnjsonify({"result":"Correct! You guessed the right number."}),200