└── Python Program to Calculate Age /Python Program to Calculate Age: -------------------------------------------------------------------------------- 1 | from datetime import date 2 | 3 | 4 | def age(birthdate): 5 | today = date.today() 6 | age = today.year - birthdate.year - \ 7 | ((today.month, today.day) < (birthdate.month, birthdate.day)) 8 | return age 9 | 10 | 11 | birthdate = date(1996, 2, 27) 12 | 13 | print(f"With birth date of {birthdate}, you are {age(birthdate)} years old") 14 | --------------------------------------------------------------------------------