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