You are viewing a single comment's thread. Return to all comments →
def is_leap(year): leap = False; if year%4 == 0: if year%100 == 0: if year%400 == 0: leap = True; else: leap = False; else: leap = True; else: leap = False; return leap;
This works, but can anyone tell me how to shorten it to year%4 == 0 and (year%100 != 0 and year%400 == 0) .
Thanks in advance :)
Seems like cookies are disabled on this browser, please enable them to open this website
Write a function
You are viewing a single comment's thread. Return to all comments →
def is_leap(year): leap = False; if year%4 == 0: if year%100 == 0: if year%400 == 0: leap = True; else: leap = False; else: leap = True; else: leap = False; return leap;
This works, but can anyone tell me how to shorten it to year%4 == 0 and (year%100 != 0 and year%400 == 0) .
Thanks in advance :)