← Back to challenges

Find Out the Leap Year

PythonMediumalgebraalgorithmsvalidation

Instructions

A leap year happens every four years, so it's a year that is perfectly divisible by four. However, if the year is a multiple of 100 (1800, 1900, etc), the year must be divisible by 400.

Write a function that determines if the year is a leap year or not.

Examples

leap_year(2020) ➞ True

leap_year(2021) ➞ False

leap_year(1968) ➞ True

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Format I: Template String