From 5c940e41fd056f4b882d672684ac02185589865e Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 20:39:53 +0000 Subject: [PATCH] [Sync Iteration] python/darts/1 --- solutions/python/darts/1/darts.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 solutions/python/darts/1/darts.py diff --git a/solutions/python/darts/1/darts.py b/solutions/python/darts/1/darts.py new file mode 100644 index 0000000..5b3d771 --- /dev/null +++ b/solutions/python/darts/1/darts.py @@ -0,0 +1,26 @@ +def score(x, y): + pass + distance_squared = x**2 + y**2 + + # Define the squared radii for comparison + RADIUS_1_SQUARED = 1**2 # 1 (Inner Circle) + RADIUS_5_SQUARED = 5**2 # 25 (Middle Circle) + RADIUS_10_SQUARED = 10**2 # 100 (Outer Circle / Max Target) + + # 2. Use conditional logic, checking the smallest (highest score) circle first. + + if distance_squared <= RADIUS_1_SQUARED: + # Distance <= 1: Inner Circle + return 10 + + elif distance_squared <= RADIUS_5_SQUARED: + # 1 < Distance <= 5: Middle Circle + return 5 + + elif distance_squared <= RADIUS_10_SQUARED: + # 5 < Distance <= 10: Outer Circle + return 1 + + else: + # Distance > 10: Outside the target + return 0 \ No newline at end of file