Premium problem36. Monty Hall Simulator

Easy Locked

Simulate n games of Monty Hall and return (stay_rate, switch_rate), the fraction of games won by each strategy.

Each game:

  • the car is behind a uniformly random door out of 3
  • the player picks a uniformly random door
  • the host opens a different door that is not the car
  • staying wins if the first pick was the car; switching wins if it was not

Seed np.random.seed(seed) inside solve, immediately before drawing.

Input

n = 10000
seed = 0

Output

(0.3308, 0.6692)

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)