Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

with PYTHON create simulation that is going to be just for the first round of craps, during which you make a bet and roll two

with PYTHON create simulation that is going to be just for the first round of craps, during which you make a bet and roll two six-sided dice, whereupon:

  1. If the sum of the two dice is 7 or 11, you win the bet!

  2. If the sum of the two dice is 2, 3, or 12, you lose. :(

  3. If the sum is anything else, you dont gain or lose any money.

Write a simulation to play this first round of craps over and over until either (1) you run out of money, or (2) you double your money. Start with $100, and randomly choose an amount to bet on each round from $5 to $20; the bet will stay consistent throughout the entire simulation.

Over and over again, roll two dice using random.randint, and determine whether you win (add the bet amount to your total), lose (subtract the bet amount from your total), or draw. Play until one of the two stopping conditions occurs, and then report back to the user:

  1. How much money they ended up with

  2. How many rounds were wins, losses, and draws

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

5 9 6 .

Answered: 1 week ago