Python Programming
Leap Year
Python program for checking given year is a leap year or not
By Geekboots
7/23/2021
0 views
leap-year.pyPython
#!/usr/bin/evn python
# Take year as input from the user
year = int(input("Enter a year: "))
# Compare mod value of the year with zero
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 *****
# Enter a year: 2016
# 2016 is a leap year
#or
# Enter a year: 2017
# 2017 is a leap year
Pythonleap year