Calculate the odds
The histogram of the previous exercise was created from a NumPy array ends
, that contains 500 integers. Each integer represents the end point of a random walk. To calculate the chance that this end point is greater than or equal to 60, you can count the number of integers in ends
that are greater than or equal to 60 and divide that number by 500, the total number of simulations.
Well then, what's the estimated chance that you'll reach at least 60 steps high if you play this Empire State Building game? The ends
array is everything you need; it's available in your Python session so you can calculate it.
This exercise is part of the course
Intermediate Python
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
