Basic Programs

If Else Programs

While loop Programs

For loop Programs

List Programs


Python Program to Check Given Year is Leap Year or Not


The following example shows, how to check whether given year is Leap or Not.

Steps
  1. Get the year as ainput from user.
  2. If a year is divisible by 4 or 400, it is a leap year.
  3. If that year is divisible by 100, it is not a leap year,
Here the Example Check the given year is Leap year or Not using if,else statement.
Example.py
year = int(input("Enter the Year : "))
if (year%400 == 0) or (year%4==0 and year%100!=0):
    print("Leap Year")
else:
    print("Not a Leap Year")

Output 1

Enter the Year : 2024
Leap Year 

Output 2

Enter the Year : 2001
Not a Leap Year 

Prev Next