mirror of
https://github.com/Xevion/exercism.git
synced 2026-02-01 00:24:16 -06:00
darts exercise
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
from math import sqrt
|
||||
|
||||
def dist(x1, y1, x2=0, y2=0):
|
||||
return sqrt(((x2 - x1) ** 2) + ((y2 - y1) ** 2))
|
||||
|
||||
def score(x, y):
|
||||
distance = dist(x, y)
|
||||
return 10 if distance <= 1 else 5 if distance <= 5 else 1 if distance <= 10 else 0
|
||||
Reference in New Issue
Block a user