+ 1
Please check whats wrong with the 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
1 Réponse
+ 6
elif month == 1 or 3 or 5 or 7 or 8 or 10 or 12 won't work. You need to use elif month == 1 or month == 3 or month == 5... instead, or simply elif month in (1, 3, 5, 7, 8, 10, 12).
Also, logical and is 'and' in python. Not '&'