-
Notifications
You must be signed in to change notification settings - Fork 240
/
Monte hall.py
36 lines (35 loc) · 973 Bytes
/
Monte hall.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
import random
doors=[0]*3
goatdoor=[0]*2
swap=0
dont_swap=0
j=0
while(j<10):
x=random.randint(0,2)
doors[x]="BMW"
for i in range (0,3):
if(i==x):
continue
else:
doors[i]="goat"
goatdoor.append[i]
choice=int(input("Enter your choice"))
door_open=random.choice(goatdoor)
while(door_open==choice):
door_open=random.choice(goatdoor)
ch=input("do you want to swap? y/n")
if(ch=='y'):
if(doors[choice]=='goat'):
print("player wins")
swap=swap+1
else:
print("player lost")
else:
if(doors[choice]=='goat'):
print("player lost")
else:
print("player wins")
dont_swap=dont_swap+1
j=j+1
print(swap)
print(dont_swap)