Exercise

# Simulating the dice game

We now know how to implement the first three steps of a simulation. Now let's consider the next step - repeated random sampling.

Simulating an outcome once doesn't tell us much about how often we can expect to see that outcome. In the case of the dice game from the previous exercise, it's great that we won once. But suppose we want to see how many times we can expect to win if we played this game multiple times, we need to repeat the random sampling process many times. Repeating the process of random sampling is helpful to understand and visualize inherent uncertainty and deciding next steps.

Following this exercise, you will be familiar with implementing the fourth step of running a simulation - sampling repeatedly and generating outcomes.

Instructions

**100 XP**

- Set
`sims`

to 100 repetitions and initialize`wins`

to 0. - Write a for loop to repeat throwing the dice.
- Set
`outcomes`

to the outcome of throwing two dice. - If the two dice show the same number, increment
`wins`

by 1.