Exercise

Simulate multiple walks

A single random walk is one thing, but that doesn't tell you if you have a good chance at winning the bet.

To get an idea about how big your chances are of reaching 60 steps, you can repeatedly simulate the random walk and collect the results. That's exactly what you'll do in this exercise.

The sample code already sets you off in the right direction. Another for loop is wrapped around the code you already wrote. It's up to you to add some bits and pieces to make sure all of the results are recorded correctly.

Note: Don't change anything about the initialization of all_walks that is given. Setting any number inside the list will cause the exercise to crash!

Instructions

100 XP
  • Fill in the specification of the for loop so that the random walk is simulated 10 times.
  • After the random_walk array is entirely populated, append the array to the all_walks list.
  • Finally, after the top-level for loop, print out all_walks.