Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_age():
- while True:
- try:
- age = int(input('Enter your age: '))
- if age in range(18, 111):
- break
- # elif age in range (0, 19):
- # break
- except:
- pass
- print('\nIncorrect input, try again')
- print("left loop")
- print(age)
- return age
- def number_line(age):
- for i in range(1, 19):
- if i == age:
- print("This is how old you are:", age)
- continue
- elif i == 18:
- print("18: This is the voting age")
- continue
- print(i)
- def main():
- check_age()
- number_line(age)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement