-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdarts.py
42 lines (37 loc) · 1008 Bytes
/
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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
player_name = input()
game = ''
points_left = 301
successful = 0
unsuccessful = 0
while True:
type = input()
if type == 'Retire':
print(f'{player_name} retired after {unsuccessful} unsuccessful shots.')
break
points = int(input())
if type == 'Single':
points = points
if points <= points_left:
points_left -= points
successful += 1
else:
unsuccessful += 1
elif type == 'Double':
points = (points * 2)
if points <= points_left:
points_left -= points
successful += 1
else:
unsuccessful += 1
elif type == 'Triple':
points = (points * 3)
if points <= points_left:
points_left -= points
successful += 1
else:
unsuccessful += 1
if points_left == 0:
print(f"{player_name} won the leg with {successful} shots.")
break
type = input()
points = int(input())