File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #Monte Mall
2
+ import random
3
+ doors=[0]*3
4
+ goatdoor=[0]*2
5
+ swap=0
6
+ dont_swap=0
7
+ j=0
8
+ while(j<5):#you can take any integer value
9
+ x=random.randint(0,2)
10
+ doors[x]="BMW"
11
+ for i in range (0,3):
12
+ if(i==x):
13
+ continue
14
+ else:
15
+ doors[i]="GOAT"
16
+ goatdoor.append(i)
17
+ choice=int(input("enetr your choice"))
18
+ door_open=random.choice(goatdoor)
19
+ while(door_open==choice):
20
+ door_open=random.choice(goatdoor)
21
+ ch=input("do you want to swap? y/n::")
22
+ if(ch=="y"):
23
+ if(doors[choice]=="GOAT"):
24
+ print("player wins")
25
+ swap=swap+1
26
+ else:
27
+ print("player lost")
28
+ else:
29
+ if(doors[choice]=="GOAT"):
30
+ print("player lost")
31
+ else:
32
+ print("player wins")
33
+ dont_swap=dont_swap+1
34
+ j=j+1
35
+ print(swap)
36
+ print(dont_swap)
You can’t perform that action at this time.
0 commit comments