You are viewing a single comment's thread. Return to all comments →
That exactly is not the case. Try to run following code in interpreter:
return (not(year%4) and ((year%100) or not(year%400)))
Invoke it using
It returns 64 instead of True. Thats because the expression (year%100) returns 64
to mitigate that run following code and that returns either True or False:
return (not(year%4) and (bool(year%100) or not(year%400)))
kpagcha statement works all you have to do is wrap the return statement inside a open and closed brackets like this.
return ( year % 4 == 0 and (year % 400 == 0 or year % 100 != 0))
How does that contradict what that guy said? You wrote different code than what he wrote. You're exploiting "truthy/falsey" values; the other guy's just using regular booleans
check again. he also used == signs to evaluate it to a boolean expression.
the == operator evaulatues the conditon to a boolean