+ 1
Can anyone give suggestions for my "Birth Year Calculator" ?
I've made this code but it does not give accurate year always! For eg. The year sometimes come 1 year ahead or before. Can anyone tell me why? Please suggest edits....🖊️ https://code.sololearn.com/cxVDXmMhNk07/?ref=app
22 odpowiedzi
+ 2
Yusuf Ansari 1999 +21 = 2020
+ 2
suuuure!!!
enter age
enter linefeed
enter y or n
submit
+ 1
well it has to know whether the person already had its birthday this year! otherwise it cant calculate the birthdate correctly.....
+ 1
If you say:
b=int(input()) and has to be the last year in which the person had burthday it should work.
So if the person already had birthday you should set b=2020
else b=2019.
You understand?
+ 1
get dayOfYear from now
get dayOfYear from his birthday.
+ 1
simply ask with a 2nd input if person had birthday this year😉
0
you have example data?
0
Can't get you?
0
when do we get an error
please give specific data
0
For eg. my friend's age is 21 and he is born in 2000 , but the calculator gives it as 1999
0
Ik bro but it did not give right answer
0
Okay Alexander Thiem , so how can I rectify it?
0
Alexander and Oma I'm not getting you properly , could you please edit my code and send it here?
0
Umm...bro it's not running 😅
0
Okay thanks bro 😊
0
A more general version if you want to include dead people that also works next year.....
https://code.sololearn.com/cYz6v2maOsJ1/?ref=app
0
Worked for me, though some very good and confusing points have come up in this forum....
0
Hey Yusuf Ansari, I'm not good at explaining but like Alexander Thiem and Oma Falk had said already that we need two inputs.
One for the age and the other to check if the user had already finished his/her birthday this year.
Here is a code, hope this helps you.
https://code.sololearn.com/cZR4B3IfZvES/?ref=app
0
Birth_year=input("enter birthday year")
Age=2020-int(birth_year)
Print (age)
output
birth_year=1999
age=2020-1999
21