Sumita D.

asked • 11/09/22

ANALYZING THE GAME OF CRAPS

Write a Script to play 1,000,000 games of craps. Use a wins dictionary to keep track of the number of games won for a particular number of rolls. Similarly, use a losses dictionary to keep track of the number of games lost for a particular number of rolls. As the simulation proceeds, keep updating the dictionaries.

A typical key–value pair in the wins dictionary might be

4: 50217

indicating that 50217 games were won on the 4th roll. Display a summary of the results including:

  1. the percentage of the total games played that were won.
  2. the percentage of the total games played that were lost.
  3. the percentages of the total games played that were won or lost on a given roll (column 2 of the sample output).
  4. the cumulative percentage of the total games played that were won or lost up to and including a given number of rolls (column 3 of the sample output).


1 Expert Answer

By:

Dylan K. answered • 11/19/22

Tutor
New to Wyzant

Seasoned Software Developer - Data Driven - Python - Comp Science

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.