python leap year code example
Example 1: python leap year solution
def is_leap(year):
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
Example 2: python check if year is a leap year
import calendar
print(calendar.isleap(1900))
def is_leap(year):
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
import calendar
print(calendar.isleap(1900))