w3resource

Python TextCalendar Module: leapdays() method

leapdays() method

The leapdays() method is used to get the number of leap years in a specified range of years.
This function works for ranges spanning a century change.

Syntax:

leapdays(y1, y2)

Parameters:

Name Description Required /
Optional
Type
y1, y2 y1 and y2 are years to get the number of leap years. Required Number

Example of leapdays() method

import calendar
print(calendar.leapdays(2015, 2018))

Output:

1

Previous: isleap()
Next: weekday()

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/leapdays.php