Leap Year Check

Leap years keep the calendar aligned with Earth’s movement around the Sun. The function leap_year receives a year year and checks this rule: a year is leap if it is divisible by 4 but not by 100, unless it is also divisible by 400. Return True for a leap year and False for a regular year.

Примеры

Ввод
2000
Вывод
True
Ввод
1900
Вывод
False
Ввод
2024
Вывод
True

Нужно реализовать

def leap_year(year: int) -> bool:

Теги

math
PostgreSQLv16

Här visas resultatet av din kod

Visible tests
1
Input
2000
ExpectedTrue
2
Input
1900
ExpectedFalse
3
Input
2024
ExpectedTrue
4
Input
2023
ExpectedFalse
5
Input
1600
ExpectedTrue
6
Input
2100
ExpectedFalse
Focus radio
Paused · SomaFM · Fluid