Challenge: Leap Year

Lab Python Intermediate 20 points

A year is a leap year if it divides by 4, except years that divide by 100 – unless they also divide by 400. So 2024 and 2000 are leap years, but 1900 is not.

Input

One year.

Output

<year> is a leap year or <year> is not a leap year.

Example

Input

2024

Output

2024 is a leap year
Sample input available Sample output available
Editor
Python

Hints

“divides by 4” means year % 4 == 0.

Combine the rules with and / or, and use brackets.

Solution explanation

It's a leap year when it divides by 4 but not by 100, or when it divides by 400.

Show solution
year = int(input())
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")
Output
Answer
HOME LEARN COMMUNITY DASHBOARD