Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Turlagh.Clancy/gitlab_workshop
1 result
Show changes
Commits on Source (2)
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__':
......