+ 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

7th Jul 2020, 3:26 PM
Yusuf Ansari
Yusuf Ansari - avatar
22 odpowiedzi
+ 2
Yusuf Ansari 1999 +21 = 2020
7th Jul 2020, 3:42 PM
SR ​
SR ​ - avatar
+ 2
suuuure!!! enter age enter linefeed enter y or n submit
7th Jul 2020, 5:05 PM
Oma Falk
Oma Falk - avatar
+ 1
well it has to know whether the person already had its birthday this year! otherwise it cant calculate the birthdate correctly.....
7th Jul 2020, 4:00 PM
Alexander Thiem
Alexander Thiem - avatar
+ 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?
7th Jul 2020, 4:06 PM
Alexander Thiem
Alexander Thiem - avatar
+ 1
get dayOfYear from now get dayOfYear from his birthday.
7th Jul 2020, 4:44 PM
Oma Falk
Oma Falk - avatar
+ 1
simply ask with a 2nd input if person had birthday this year😉
7th Jul 2020, 4:54 PM
Oma Falk
Oma Falk - avatar
7th Jul 2020, 4:58 PM
Oma Falk
Oma Falk - avatar
0
you have example data?
7th Jul 2020, 3:31 PM
Oma Falk
Oma Falk - avatar
0
Can't get you?
7th Jul 2020, 3:32 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
when do we get an error please give specific data
7th Jul 2020, 3:36 PM
Oma Falk
Oma Falk - avatar
0
For eg. my friend's age is 21 and he is born in 2000 , but the calculator gives it as 1999
7th Jul 2020, 3:37 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
Ik bro but it did not give right answer
7th Jul 2020, 3:51 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
Okay Alexander Thiem , so how can I rectify it?
7th Jul 2020, 4:03 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
Alexander and Oma I'm not getting you properly , could you please edit my code and send it here?
7th Jul 2020, 4:54 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
Umm...bro it's not running 😅
7th Jul 2020, 5:03 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
Okay thanks bro 😊
7th Jul 2020, 5:12 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
A more general version if you want to include dead people that also works next year..... https://code.sololearn.com/cYz6v2maOsJ1/?ref=app
7th Jul 2020, 6:03 PM
Alexander Thiem
Alexander Thiem - avatar
0
Worked for me, though some very good and confusing points have come up in this forum....
7th Jul 2020, 6:10 PM
Yashika Raja
Yashika Raja - avatar
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
9th Jul 2020, 3:08 AM
Sahil Monish Lal (Offline)
Sahil Monish Lal (Offline) - avatar
0
Birth_year=input("enter birthday year") Age=2020-int(birth_year) Print (age) output birth_year=1999 age=2020-1999 21
9th Jul 2020, 7:24 AM
Soundarya Kallur
Soundarya Kallur - avatar