Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Quick game of darts.

View darts.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
def test_cases():
darts(0)
darts(1)
darts(3)
darts(-1)
darts(15)
darts(16)
 
def darts(x):
C = 0
if x-C>=0 and x-C<=10 and x-C==0:
print 'Bullseye! 10 points!'
elif x-C>0 and x-C<=10:
print '%d points!' % (10-x)
elif x-C>15:
print 'You hit the bartender. Get out!'
exit()
else:
print 'Miss!'
if __name__ == '__main__':
test_cases()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.