Write a python function to calculate the age with the user provided date of birth


Topic: Write a python function to calculate the age with the user provided date of birth

Solution

from datetime import date
def calculate_age(dtob):
    today = date.today()
    return today.year - dtob.year - ((today.month, today.day) < (dtob.month, dtob.day))



List all Python Programs