From 0b3a725b43d321f62336fd488d74a450aa5f106a Mon Sep 17 00:00:00 2001 From: Zaiying Yang <155413583+yvetteya@users.noreply.github.com> Date: Tue, 24 Sep 2024 15:08:11 +0000 Subject: [PATCH 1/2] Complete leap.py --- leap/leap.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/leap/leap.py b/leap/leap.py index 50fd034..b8198e6 100644 --- a/leap/leap.py +++ b/leap/leap.py @@ -1,2 +1,14 @@ def leap_year(year): - pass + if year % 400 == 0: + return True + elif year % 100 == 0: + return False + elif year % 4 == 0: + return True + else: + return False + +#print(leap_year(2004)) + + + From 2b4dffbfdfc2adfea87598c0532b4127ed807571 Mon Sep 17 00:00:00 2001 From: Zaiying Yang <155413583+yvetteya@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:08:50 +0000 Subject: [PATCH 2/2] Complete darts.py --- darts/darts.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/darts/darts.py b/darts/darts.py index 4ba1b3b..003961a 100644 --- a/darts/darts.py +++ b/darts/darts.py @@ -1,2 +1,16 @@ +import math + def score(x, y): - pass + # Calculate the distance from the center using the Pythagorean theorem + distance = math.sqrt(x**2 + y**2) + + # Determine the score based on the distance + if distance <= 1: + return 10 # Inner circle + elif distance <= 5: + return 5 # Middle circle + elif distance <= 10: + return 1 # Outer circle + else: + return 0 # Outside the target +