# Leap year in python

Python Program to get a year and check whether year is leap year or not.

Sample Input 1:

2016

Sample Output 1:

Leap year

Sample Input 2:

2017

Sample Output 2:

Not Leap Year

#### Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#### Program or Solution

```
```
year = int(input("Enter a year: "))

if (year % 4) == 0:

if (year % 100) == 0:

if (year % 400) == 0:

print("{0} is a leap year".format(year))

else:

print("{0} is not a leap year".format(year))

else:

print("{0} is a leap year".format(year))

else:

print("{0} is not a leap year".format(year))

#### Program Explanation

Get input year from user using input() method,

All the years divisible by 4 are leap year except century years. Century years are leap year if it is divisible by 400.

#### Comments

#### Related Programs

- Python if example
- Greatest of two numbers in Python
- Smallest of two numbers in python
- ODD or Even in Python
- 3 digit number or not in python
- Greatest of three numbers in Python
- Smallest of three numbers in Python
- Divisible by 3 or not in python
- Last digit divisible by 3 or not in python
- Calculator in python
- grade calculation in python
- else if in python
- check whether bit is set in python
- odd or even using bitwise operator in python