O'Reilly logo

Practical Data Science Cookbook by Abhijit Dasgupta, Benjamin Bengfort, Sean Patrick Murphy, Tony Ojeda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simulating multiple games with outcomes decided by calculations

It turns out that once we build a way to calculate the outcome of a single game, simulating multiple games doesn't require much more work. In fact, you just need a way to determine a schedule of games in advance, put the code we used in the last section into a loop, and then create a way to keep track of how many games each team has won or lost. This is exactly what we will do in this section.

Getting ready

If you completed the previous recipe, you should already have approximately a third of the code you will need for this section.

How to do it…

Perform the following steps to simulate multiple games using the same logic as in the previous recipe:

  1. As mentioned previously, the first thing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required