Python program to check whether a year is a leap

In this python, if else program, we will check whether a given year is a leap or not.

Leap Year: A year, occurring once every four years, which has 366 days including 29 February as an intercalary day. A Century year is a leap year only if it is perfectly divisible by 400.

Steps to solve the program
  1. Take a year as input through the user.
  2. Use the following conditions to check whether a year is a leap or not. a)year%100 != 0 or year%400 == 0, b) year%4 == 0.
  3. Use an if-else statement for this purpose.
  4. Print the output. 
				
					year = int(input("Enter the year: "))

if (year%100 != 0 or year%400 == 0) and year%4 == 0:
    print("The given year is leap year.")
else:
    print("The given year is not leap year.")
				
			

Output :

				
					Enter the year: 2000
The given year is leap year.
				
			

Related Articles

find the electricity bill.

Fizz-Buzz program.

Leave a Comment