You are viewing a single comment's thread. Return to all comments →
You can just reverse the order and it will be fine.
Reversing the order almost works, but you have to add an else block returning False at the end to capture cases where none of the if blocks execute (like for the year 1992) and also change all elif statements to if statements. I.e:
if year % 400 == 0:
if year % 100 == 0:
if year % 4 == 0:
This passes all the test cases.
i will mark your words
not passes year %100 == 0 test
Why wouldn't 1992 return true if % 4 == 0 is the first statement? it divides cleanly by 4 with no remainder, yet it gives false in the original scenario.
I reversed the order and it passed all the tests.
But i dont know why it did.
what did the reversing the order do??