# Exercise7-monty-and-birthday

From Lupyan Lab

## Monty Hall Problem

*Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1 [but the door is not opened], and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?*

- Write a numeric simulation of the monty hall problem and calculate the probabilities of winning if you switch and if you stay.

Solution to the monty hall simulation

## The birthday paradox

#### What is the probability that of n people in a room, some pair will have the same birthday?

*Write code to find a numerical approximation to the Birthday Problem through simulation of n people walking into a room.*

- What is the probability that in a room of n people, at least two share a birthday?
- You'll want to write a function or several functions which when given n, output the likelihood that any two people in the group share a birthday.
*Hint*: start with thinking about two people walking into a roomâ€¦

- What is the least number of people necessary for the probability to reach 50%?

- Because you are writing a numerical approximation, you'll want to run your simulations lots of times to get a distribution. To answer part 2, return
*the modal response*.