Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created September 9, 2021 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/5328d6a561544d85c62a3e6f4d721fdb to your computer and use it in GitHub Desktop.
Save amankharwal/5328d6a561544d85c62a3e6f4d721fdb to your computer and use it in GitHub Desktop.
def ageCalculator(y, m, d):
import datetime
today = datetime.datetime.now().date()
dob = datetime.date(y, m, d)
age = int((today-dob).days / 365.25)
print(age)
ageCalculator(1998, 9, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment