Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Create a program that asks the user to enter their name and their age.
- #Print out a message addressed to them that tells them the year that they will turn 100 years old.
- from datetime import datetime
- current_year = datetime.now().year
- while True:
- try:
- name = str(input("Name :"))
- if len(name) == 0:
- print("Please input name")
- else:
- print("your name is :",name)
- age = int(input("Age :"))
- if age > 0:
- print("Age is : ", age)
- temp = 100 - age
- result = temp + int(current_year)
- print("You become 100 at :",result)
- else:
- print("please input age")
- except Exception as e:
- print("Please Check Your Input ",e)
- finally:
- print("--------------------")
Add Comment
Please, Sign In to add comment