0

How I can make code to show my age

.py

22nd Nov 2019, 10:50 PM
Khalil Almahboub
Khalil Almahboub - avatar
4 Réponses
+ 4
please start the python tutorial then you will know how to
22nd Nov 2019, 11:36 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 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
23rd Nov 2019, 11:51 AM
SQrL
SQrL - avatar
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}')
23rd Nov 2019, 12:04 AM
Omar
Omar - avatar
0
Thanks for your help and l will follow you ❤ All the best
24th Nov 2019, 12:19 PM
Khalil Almahboub
Khalil Almahboub - avatar