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)
| 17 | |
| 18 | |
| 19 | def 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 | |
| 31 | if __name__ == "__main__": |