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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://198.211.115.131/python/module/calendar/isleap.php