From ff3752abf4996874f9adaf2f308dd42f1c57ef86 Mon Sep 17 00:00:00 2001 From: EAKKBooth Date: Tue, 24 Sep 2024 16:00:25 +0000 Subject: [PATCH] Complete darts.py --- darts/darts.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/darts/darts.py b/darts/darts.py index 4ba1b3b..6049314 100644 --- a/darts/darts.py +++ b/darts/darts.py @@ -1,2 +1,13 @@ def score(x, y): - pass + # Calculate the distance from the center (0, 0) to the dart's landing point + distance = math.sqrt(x**2 + y**2) + + # Determine the points 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