Wednesday, October 4, 2023
HomeProgrammingPythonPython 3 Program to Check Leap Year

# Python 3 Program to Check Leap Year

This post was last Updated on June 8, 2023 by Himanshu Tyagi to reflect the accuracy and up-to-date information on the page.

In this tutorial, you will find a simple Python 3 program to check leap year. It would be best to understand this program if you understood Python variables, operators, and if-else statements.

## Python Program to Check Leap Year

To check if a number is a leap year, it should follow these conditions:

1. The year should be completely divisible by 4.

2. The year should be utterly divisible by both 100 and 400.

Now, in the Python code, you can take year input from the user and see its divisibility by using nested if-else statements.

```year = int(input("enter the year: "))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print('%0.0f is a leap year' % year)
else:
print('%0.0f is not a leap year' % year)
else:
print('%0.0f is a leap year' % year)
else:
print('%0.0f is not a leap year' % year)```

## Output

### Other Python Programs:

Himanshu Tyagi
Hello Friends! I am Himanshu, a hobbyist programmer, tech enthusiast, and digital content creator. Founder Cool SaaS Hunter. With CodeItBro, my mission is to promote coding and help people from non-tech backgrounds to learn this modern-age skill!
RELATED ARTICLES