In this tutorial we can learn how to check whether a year is a leap or not using a python program.
We can explain A leap year has 365 days (the extra day is the 29th of February). It comes mostly every four years.
Here we can check whether a year is a leap or not. Divide the year by 4. If it is fully divided by 4, then it is a leap year.
Python Program to Check Leap Year
# Python Program to Check Leap Year
year = int(input("Enter the year: "))
# Checking Leap Year
if year % 4 == 0 and year % 100 != 0:
print(year, "is a leap year.")
elif year % 400 == 0:
print(year, "is a leap year.")
elif year % 100 == 0:
print(year, "is not a leap year.")
else:
print(year, "is not a leap year.")
Here The Output Python Program to Check Leap Year
Enter the year: 2012
2012 is a leap year.
Output 2
Enter the year: 2030
2030 is not a leap year.
Program Video to Leap Year.