Python program to calculate age and year when user will be 100 years old

#Program that will ask user his name and his date of birth and print his age and year when he will turn 100 years old.
#to enter your date use format like 8-8-1996
import datetime

name = input("Enter your name: ")
today = datetime.date.today()

birthIn = input("Enter your Birhtday in format Date-Month-Year: ")

birthday = datetime.datetime.strptime(birthIn, "%d-%m-%Y")

print("Todays date is:", today.strftime("%d-%m-%Y"))
print("Your Birthday is on: ", birthIn)

age = today.year-birthday.year
print(name +" your age is: ",age)

old = (100-age)+today.year
print("In %d you will be 100 years old" % old)

Comments

Popular posts from this blog

Python program to print numbers less than 5 from the list.