MCPcopy Create free account
hub / github.com/geekcomputers/Python / is_leap_year

Function is_leap_year

to check leap year.py:19–28  ·  view source on GitHub ↗

Return True if year is a leap year, False otherwise. Rules: - Divisible by 4 => leap year - Divisible by 100 => not leap year - Divisible by 400 => leap year

(year: int)

Source from the content-addressed store, hash-verified

17
18
19def is_leap_year(year: int) -> bool:
20 """
21 Return True if year is a leap year, False otherwise.
22
23 Rules:
24 - Divisible by 4 => leap year
25 - Divisible by 100 => not leap year
26 - Divisible by 400 => leap year
27 """
28 return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
29
30
31if __name__ == "__main__":

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected