beginner-coding-concepts/if-statements.py
2024-10-04 14:32:55 +01:00

12 lines
No EOL
299 B
Python

import datetime
dateOfBirth = datetime.datetime(1990, 9, 20)
today = datetime.datetime.now()
age = today.year - dateOfBirth.year - ((today.month, today.day) < (dateOfBirth.month, dateOfBirth.day))
print(age)
if age >= 18:
print("Enjoy the film")
else:
print("Sorry you aren't old enough")