In this article, you will learn what is Python Program to Check Leap Year
In this article, how will you check leap year?. A leap year occurred once every 4 years. This additional day is added in February which makes it 29 days long. A year is called a leap year if it contains an additional day which makes the number of the days in that year is 366.
Example:
# Python program to check if year is a leap year or not
year = 2016
# To get year (integer input) from the user
# year = int(input("Enter a year: "))
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
else:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
Output:
2016 is a leap year
Python Program to Check Leap Year, how to find leap year in python?
minify code