forked from geekcomputers/Python
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_input.py
More file actions
Latest commit
23 lines (17 loc) · 616 Bytes
/
Copy pathcheck_input.py
File metadata and controls
23 lines (17 loc) · 616 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
defget_user_input(start,end):
testcase=False
whiletestcase==False:
try:
userInput=int(input("Enter Your choice: "))
ifuserInput>6oruserInput<1:
print("Please try again.")
testcase=False
else:
returnuserInput
exceptValueError:
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.