Files
python/exercises/darts/example.py
Kevin Gasca 97c2d1db0e darts: implement new exercise (#1667)
* 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
2019-02-04 11:56:23 -05:00

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