In this program, you will learn to check whether a year is a leap year or not. We will use nested if... else to solve this problem.
#Python program to check if the input year is a leap year or not
year = 2000
# To get year (integer input ) from the user
# year = int(input("Enter s 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
2000 is a leap year