Question: Please write a Python Program . Filename: craps.py Data scientists frequently develop simulations to understand how a particular system works and even to make predictions

 Please write a Python Program . Filename: craps.py Data scientists frequently

Please write a Python Program

. Filename: craps.py Data scientists frequently develop simulations to understand how a particular system works and even to make predictions about how a system will work the future. Today, we're going to use one to play craps. Craps is my favorite casino game, although I definitely don't understand all the rules. So our simulation 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 don't 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 Here's an example of our program running. As always, your output doesn't need to look exactly the same as long as it communicates the right info! You start with $100, and a bet of $17 At the end of our simulation you have... $202 Won: 18 Lost: 12 Draw: 38

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!