* darts: implement new exercise Closes #1661 * Darts implementation * Updated README.md * darts: implement new exercise * Changed function names to be more pythonic * Changed config.json to match appropriate topics
15 lines
253 B
Python
15 lines
253 B
Python
from math import sqrt
|
|
|
|
|
|
def score(x, y):
|
|
dart_location = sqrt(x * x + y * y)
|
|
|
|
if dart_location <= 1.0:
|
|
return 10
|
|
elif dart_location <= 5.0:
|
|
return 5
|
|
elif dart_location <= 10.0:
|
|
return 1
|
|
else:
|
|
return 0
|