# Python calendar Module | leapdays() Method with Example

Python calendar.leapdays() Method: Here, we are going to learn about the leapdays() method of calendar module in Python with its definition, syntax, and examples.
Submitted by Hritika Rajput, on May 08, 2020

## Python calendar.leapdays() Method

leapdays() method is an inbuilt method of the calendar module in Python. It works on simple text calendars and returns the number of leap days between the two given years in the function argument.

Module:

```    import calendar
```

Syntax:

```    leapdays(y1, y2)
```

Parameter(s):

• y1: It is a required parameter, which specifies the starting year from where the search should start
• y2: right limit of the range, which specifies the ending year till where leap years should be searched.

Return value:

The return type of this function is an integer. The function returns the number of leap years in the given range between the two years.

Example:

```# Python program to illustrate the
# use of leapdays() method

# importing calendar module
import calendar

y1 = 2000
y2 = 2025
print("Number of leap years in the range:", calendar.leapdays(y1, y2))
print()

# years can be negative as well
y1 = -10
y2 = 1000
print("Number of leap years in the range:", calendar.leapdays(y1, y2))
print()

# Checking if the result is True
y1 = 2000
y2 = 2020
count = 0
for i in range(y1,y2):
if calendar.isleap(i):
count+=1
print(i)

print("Leap year count through iterating:", count)
print("Leap year count through function:", calendar.leapdays(y1, y2))
```

Output

```Number of leap years in the range: 7

Number of leap years in the range: 245

2000
2004
2008
2012
2016
Leap year count through iterating: 5
Leap year count through function: 5
```