Write a python function to calculate age given date of birth


Topic: Write a python function to calculate age given date of birth

Solution

from datetime import date 
def calculateAge(birthDate): 
    today = date.today() 
    age = today.year - birthDate.year - 
         ((today.month, today.day) < 
         (birthDate.month, birthDate.day)) 
  
    return age



List all Python Programs