Python program to check year is a leap year.

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

Steps to solve the program
  1. Take a year as input through the user.
  2. Use the following condition to check whether the given year is a leap year or not – (year%400 == 0 or year%100 != 0) and year%4 == 0.
  3. Print the respective output.
				
					year = int(input("Enter a year: "))

if (year%400 == 0 or year%100 != 0) and year%4 == 0:
    print(f"{year} is a leap year")
else:
    print(f"{year} is not a leap year")
				
			

Output :

				
					Enter a year: 1700
1700 is not a leap year
				
			

check the prime number.

check for the anagram.

Leave a Comment