Guest User

Untitled

a guest
Nov 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #Create a program that asks the user to enter their name and their age.
  2. #Print out a message addressed to them that tells them the year that they will turn 100 years old.
  3.  
  4. from datetime import datetime
  5.  
  6. current_year = datetime.now().year
  7. while True:
  8. try:
  9. name = str(input("Name :"))
  10. if len(name) == 0:
  11. print("Please input name")
  12. else:
  13. print("your name is :",name)
  14.  
  15. age = int(input("Age :"))
  16. if age > 0:
  17. print("Age is : ", age)
  18. temp = 100 - age
  19. result = temp + int(current_year)
  20. print("You become 100 at :",result)
  21. else:
  22. print("please input age")
  23. except Exception as e:
  24. print("Please Check Your Input ",e)
  25. finally:
  26. print("--------------------")
Add Comment
Please, Sign In to add comment