Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gitlab_workshop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Clancy Turlagh
Gitlab_workshop
Commits
e3e9c883
Commit
e3e9c883
authored
4 months ago
by
Dessy Jérôme
Browse files
Options
Downloads
Patches
Plain Diff
Corrections to the numbers
parent
b7ef6f05
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Resolve "Guess a number till 20"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flaskapp.py
+2
-2
2 additions, 2 deletions
flaskapp.py
request.py
+1
-1
1 addition, 1 deletion
request.py
with
3 additions
and
3 deletions
flaskapp.py
+
2
−
2
View file @
e3e9c883
...
...
@@ -7,7 +7,7 @@ from flask import Flask, request, jsonify
app
=
Flask
(
__name__
)
# Generate a random number between 1 and 11
secret_number
=
random
.
randint
(
1
,
2
0
)
secret_number
=
random
.
randint
(
1
,
2
1
)
@app.route
(
'
/guess
'
,
methods
=
[
'
POST
'
])
...
...
@@ -19,7 +19,7 @@ def guess_number():
user_guess
=
data
[
'
guess
'
]
if
not
isinstance
(
user_guess
,
int
)
or
user_guess
<
1
or
user_guess
>
2
0
:
if
not
isinstance
(
user_guess
,
int
)
or
user_guess
<
1
or
user_guess
>
2
1
:
return
jsonify
({
"
error
"
:
"
Guess must be an integer between 1 and 11
"
}),
400
if
user_guess
==
secret_number
:
...
...
This diff is collapsed.
Click to expand it.
request.py
+
1
−
1
View file @
e3e9c883
...
...
@@ -22,7 +22,7 @@ def make_guess(guess):
# Make 5 random guesses
for
_
in
range
(
12
):
# Generate a random guess between 1 and 11
guess
=
random
.
randint
(
1
,
2
0
)
guess
=
random
.
randint
(
1
,
2
1
)
make_guess
(
guess
)
# Try an invalid guess (string instead of integer)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment