Write a Python program that checks if a year entered by the user is a leap year or not. Print an appropriate message.
Example:
Input: 2000 Output: 2000 is a leap year
A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400.
year = int(input("Enter a year: "))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
else:
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
Unlock AI & Data Science treasures. Log in!