Menu
CoddyTech

Leap Year

You get a year year of the Gregorian calendar. Return true if it is a leap year, the kind that has a 29th of February, and false otherwise.

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

Function

isLeapYear(year: integer) → boolean
yearinteger
the year to check
Returnsboolean
true when the year has a 29th of February, false otherwise

Constraints

  • 1 ≤ year ≤ 106

Examples

Input
year = 2024
Output
true
Explanation
2024 is divisible by 4 and is not a century year, so it is a leap year.

lock icon+16 hidden tests on Submit

Reset code
def isLeapYear(year):
    # Write code here
Test cases

Case 1

Case 2

Case 3

Input

year = 2024

Expected

true