Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- now = datetime.datetime.now()
- now_year = int(str(now.year))
- now_month = int(str(now.month))
- now_day = int(str(now.day))
- birth_day = int(input("Day of birth >>> "))
- birth_month = int(input("Month of birth >>> "))
- birth_year = int(input("Year of birth >>> "))
- years = now_year - birth_year if now_month > birth_month else now_year - birth_year - 1
- months = 12 + now_month - birth_month if now_month < birth_month else now_month - birth_month
- days = 0
- if now_day > birth_day:
- days = now_day - birth_day
- else:
- days = now_day
- print(f"Your age is: {years} years {months} months {days} days!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement