w3resource

Python TextCalendar Module : isleap() method

isleap() method

The isleap() method returns True if the year is a leap year, otherwise False.

Note : A leap year is a year containing one additional day added to keep the calendar year synchronized with the astronomical or seasonal year.

Syntax:

isleap(year)

Parameters:

Name Description Required /
Optional
Type
year Year to test leap year or not. Required Number

Example - 1: isleap() method

import calendar
print(calendar.isleap(2016))

Output:

True

Example -2: isleap() method

import calendar
print(calendar.isleap(2015))

Output:

False

Previous: firstweekday()
Next: leapdays()

Test your Python skills with w3resource's quiz



Follow us on Facebook and Twitter for latest update.