-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
54 lines (38 loc) · 1.05 KB
/
main.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import random
wins = int()
losses = int()
for x in range(100):
cases = [
['Goat', 'Goat', 'Car' ],
['Goat', 'Car' , 'Goat'],
['Car' , 'Goat', 'Goat' ],
]
random_case = random.randrange(0, 3)
case = cases[random_case]
player_choice = random.randrange(0, 3)
remove_door = random.randrange(3)
while remove_door == player_choice or case[remove_door] == 'Car':
remove_door = random.randrange(3)
switch_choice = 3 - player_choice - remove_door
player_choice = switch_choice
if case[player_choice] == 'Car':
wins += 1
else:
losses += 1
percentage_win = (wins / (wins + losses)) * 100
print(percentage_win)
# -------------
'''
remove_door = int()
while True:
remove_door = random.randrange(0, 3)
if remove_door == player_choice or case[remove_door] == 'Car':
continue
else:
break
case.pop(remove_door)
if player_choice == 0:
player_choice = 1
else:
player_choice = 0
'''