Fri Jul 23 2021
Leap Year
Python Programming1078 views
File Name: leap-year.py
#!/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
Reference:
Author:Geekboots