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
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://www.w3resource.com/python/module/calendar/leapdays.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics