Day 3Leap Year

    Easyconditionsmath

    Write is_leap(year) that returns True if year is a leap year and False otherwise.

    A year is a leap year if it is divisible by 4, except years divisible by 100, which are not, unless they are also divisible by 400.

    Examples

    Example 1
    >>> is_leap(2024)
    True
    Example 2
    >>> is_leap(1900)
    False
    Example 3
    >>> is_leap(2000)
    True

    Good to know

    • So 2024 is a leap year, 1900 is not, and 2000 is.

    Run examples checks the 3 examples above. Submit runs all 7 tests, including hidden edge cases, and marks the challenge solved.

    solution.py
    Loading Python…

    Test results show up here

    Write is_leap in the editor, then run the examples. Use print() freely: its output is shown for each test.