Here's the function:
def is_leap(year):
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
return True
return False
Or more concisely:
def is_leap(year):
return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)
The condition itself is a boolean, so you can return it directly instead of if condition: return True else: return False.
Test edge cases: (True), (False), (True), (False).