Please explain why this code is wrong. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Please explain why this code is wrong.

Please tell me whats wrong with this code. This is a day calculator.It takes input of a beginning month and year and an ending month and year,and calculates the number of days inbetween.I am new to python,and my logic might be ridiculous for experienced coders,but please tell me why this code doesnt work.in sololearn,it says time limit exceeded,and in jupyter,it doesnt print the number of days.Seems like the loop won’t end. https://code.sololearn.com/cegORpj49aS6/?ref=app

19th Mar 2019, 1:29 PM
Soham Roy
Soham Roy - avatar
9 Answers
+ 6
You have to change "&" with "and" as "&" is for bitwise operation and “and “ is a logical operator
19th Mar 2019, 2:25 PM
notqueued
notqueued - avatar
+ 6
I tried to initialize norse and dayzee to 0 outside the while loop and still got the time limit exceed error
19th Mar 2019, 2:01 PM
notqueued
notqueued - avatar
+ 6
And also when month equals 4, 6,etc norse should be 30, not 31
19th Mar 2019, 2:26 PM
notqueued
notqueued - avatar
+ 1
no i have saved the ending year and month as variables year2 and month2
19th Mar 2019, 1:57 PM
Soham Roy
Soham Roy - avatar
+ 1
please review the code sir.it doesnt work in pc either.Wont execute the last 2 commands
19th Mar 2019, 2:03 PM
Soham Roy
Soham Roy - avatar
+ 1
Bishu Giri,i am afraid that you are pathetically dimwitted,and are incapable and incompetent of coding.
20th Mar 2019, 2:52 PM
Soham Roy
Soham Roy - avatar
+ 1
Bishu Giri we ought not to deny the truth.
20th Mar 2019, 3:38 PM
Soham Roy
Soham Roy - avatar
- 1
What exactly are you trying to achieve with this code? Give more examples
20th Mar 2019, 10:35 AM
Bishu Giri
Bishu Giri - avatar
- 1
I'm afraid you will continue being at same level with the attitude. focus on your development
20th Mar 2019, 3:06 PM
Bishu Giri
Bishu Giri - avatar