Code Library


leap year program:
   
Leap years are years where an extra day is added to the end of the shortest month, February. This so-called intercalary day, February 29, is commonly referred to as leap day. Leap years have 366 days instead of the usual 365 days and occur almost every four years.

year = int(input("Enter a year: "))


if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):
   print(year, "is a leap year")
else:
   print(year, "is not a leap year")
Enter a year: 2021
2021 is not a leap year