Answers for "python birthdate check age"

7

python calculate age from date of birth

from datetime import date

def calculate_age(born):
    today = date.today()
    return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
Posted by: Guest on April-17-2021
0

age check python

#  Imports
import datetime

#  Variables & Big Catching
age = input('What year where you born? ')
if age.isdigit() is False:
    print('Please enter a number')
    quit()
elif len(age) != 4:
    print('Please enter a valid year!')
    quit()
elif age.isdigit() is True and len(age) == 4:
    int_age = int(age)
current_time = datetime.datetime.now().year
print('You are', current_time - int_age, 'Years old')
Posted by: Guest on March-15-2021

Code answers related to "python birthdate check age"

Python Answers by Framework

Browse Popular Code Answers by Language