0
Leap Year
I made this code to determine whether a year was a leap year but when I ran it it failed 4 out of the seven test cases. The first condition was for it to be divide by 4, then 100 then 400. This is the code: year = int(input()) if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: print('Leap year') else: print('Not a leap year') I was confused whether the conditions should be separated or if the year has to meet all the conditions before it can be considered a leap year.
2 Réponses
+ 2
Hi! If the year is not divided without a residue by 100, then it is leap, but you have the opposite
0
Add a proper else parts for first 2 outer if parts..
"Otherwise..." part missing.