- isleap() is a python function which is predefined in the calendar module.
-Work of isleap() function is to check the year is leap year or not.
Syntax-
calendar.isleap(year)
-It return True if year is leap year otherwise return False
Example-
calendar.isleap(2016) will return True
calendar.isleap(2018) will return False
program-
import calendar
print("Enter year to check it is leap year or not")
y=int(input())
c=calendar.isleap(y)
print(c)
if c==True:
print(y,'is leap year')
else:
print(y,'is not leap year')
Enter year to check it is leap year or not
2016
True
2016 is leap year
Enter year to check it is leap year or not
2003
False
2003 is not leap year