Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import date
- import pandas as pd
- born_inString = input('What year were you born? ')
- born_inDate = pd.to_datetime(born_inString)
- def calculate_age(born_inDate):
- today = date.today()
- return today.year - born_inDate.year - ((today.month, today.day) < (born_inDate.month, born_inDate.day))
- print(f'You are {calculate_age(born_inDate)} years old.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement