3 ms·
How about this? import numpy as np def play_monty_hall(rounds=100): car = np.random.randint(low=1,high=4,size=rounds) first_door =
by jtsuken 6y ago
How about this?
import numpy as np
def play_monty_hall(rounds=100):
car = np.random.randint(low=1,high=4,size=rounds)
first_door = np.random.randint(low=1,high=4,size=rounds)
switching_wins = car != first_door
staying_wins = np.logical_not(switching_wins)
print(sum(switching_wins))
print(sum(staying_wins))
- jtsuken 6y agoResult from 1,000,000 games: Switching wins: 667,299 Staying wins: 332,701