1from datetime import date
2
3def calculate_age(born):
4 today = date.today()
5 return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
1import datetime
2Year_of_birth = int(input("In which year you took birth:- "))
3current_year = datetime.datetime.now().year
4Current_age = current_year - Year_of_birth
5print("Your current age is ",Current_age)
1#Python Calculate Age from date of birth:
2
3from datetime import date
4
5def calculate_age(born):
6 today = date.today()
7 return today.year - born.year - ((today.month, today.day) < (born.month, born.day))