CJCoding With Joseph
15free / daySign inCreate account

Leap Year Function

Write the body of is_leap_year(year: int) -> bool so it returns True for a leap year and False otherwise. A year is a leap year when it divides evenly by 4, except that a year divisible by 100 is not a leap year unless it also divides evenly by 400; the remainder operator % gives the leftover of a division, and a leftover of 0 means it divides evenly. Check 400 first, then 100, then 4. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: one line, a year as an integer, which the tests read and pass to your function before printing the value it returns.

Expected Output:

True

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
FunctionsOperators
📥 Auto-Input:
2000\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.