From eb80f955d76611809f8c690fc3e79193655cd8a9 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 25 Mar 2024 10:27:39 +0100 Subject: [PATCH] Solve python/exercises/leap --- python/leap/leap.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/leap/leap.py b/python/leap/leap.py index 50fd034..94fdd7a 100644 --- a/python/leap/leap.py +++ b/python/leap/leap.py @@ -1,2 +1,9 @@ def leap_year(year): - pass + hundred_special = year % 100 == 0 + + if year % 4 == 0 and not hundred_special: + return True + if year % 4 == 0 and hundred_special and year % 400 == 0: + return True + + return False