Leap Year Program in Python using If else Statement
ADVERTISEMENTS
Leap year program in python using if else statement. In this article, you will learn how to make a leap year program in python using if else statement.
Samples of the leap years
1992, 1996, ....., 2008, 2012 are the leap years
Source Code
# Leap Year Program in Python using If else Statement
y = None
# y - denotes the year
print ("----Enter the year----")
y = int (input ())
if y % 400 == 0:
print("\n", y, " is the leap year.")
elif y % 100 == 0:
print ("\n", y, " is not the leap year.")
elif y % 4 == 0:
print ("\n", y, " is the leap year.")
else:
print ("\n", y, " is not the leap year.")
Output
----Enter the year----
2008
2008 is the leap year.