0
How I can make code to show my age
.py
4 Answers
+ 4
please start the python tutorial then you will know how to
+ 1
for your personal safety in an identy theft threatened world, putting your dob in publicly shared code is a security risk whether 39 or 9
0
# import date to get current date
from datetime import date
# yob stands for year of birth, you should give it as an input
yob = input('Enter year of birth')
# calculate age as difference between current year and input year of birth
age = date.today().year - int(yob)
# show the age
print(f'Your age is: {age}')
0
Thanks for your help and l will follow you ā¤
All the best