FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Python/check_input.py at master · demojavascript/Python · GitHub
demojavascript
Python
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Python
/
check_input.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (15 loc) · 553 Bytes
Breadcrumbs
Python
/
check_input.py
Copy path
File metadata and controls
19 lines (15 loc) · 553 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def
get_user_input
(
start
,
end
):
while
(
1
):
try
:
userInput
=
int
(
input
(
"Enter Your choice: "
))
if
userInput
>
end
or
userInput
<
start
:
print
(
"Please try again."
)
else
:
return
userInput
except
ValueError
:
print
(
"Please try again."
)
x
=
get_user_input
(
1
,
6
)
print
(
x
)
###Asks user to enter something, ie. a number option from a menu.
###While type != interger, and not in the given range,
###Program gives error message and asks for new input.
Back
|
FazBrowse Home
|
New Git URL