I have made a Python script to test the Monty Hall Problem My issue is that the code seems to output 30% wins and 60% losses when it should be doing the opposite.
from random import randint
wins = 0
losses = 0
for i in range(1000):
correctDoor = randint(1, 3)
guessDoor = randint(1, 3)
while True:
newGuessDoor = randint(1, 3)
if newGuessDoor != guessDoor:
break
elif newGuessDoor == guessDoor:
pass
if newGuessDoor == correctDoor:
wins = wins+1
else:
losses = losses+1
print('Wins = ' + str(wins) + '\nLosses = ' + str(losses) + '')
I feel like I'm missing something blatantly obvious. Any help will be appreciated.
Aucun commentaire:
Enregistrer un commentaire