Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. def check_age():
  2. while True:
  3. try:
  4. age = int(input('Enter your age: '))
  5. if age in range(18, 111):
  6. break
  7. # elif age in range (0, 19):
  8. # break
  9. except:
  10. pass
  11. print('\nIncorrect input, try again')
  12. print("left loop")
  13. print(age)
  14. return age
  15.  
  16.  
  17. def number_line(age):
  18. for i in range(1, 19):
  19. if i == age:
  20. print("This is how old you are:", age)
  21. continue
  22. elif i == 18:
  23. print("18: This is the voting age")
  24. continue
  25. print(i)
  26.  
  27.  
  28. def main():
  29. check_age()
  30. number_line(age)
  31.  
  32. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement