Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1a . Using Python , create a craps game. Write a program that lets a user play craps. Prompt the user to enter the amount

1a. Using Python, create a craps game. Write a program that lets a user play craps. Prompt the user to enter the amount they wish to bet (table maximum: $50). Have your program roll the dice (there are two). If a 2, 3 or 12 is rolled, the user loses and the game is over. If a 7 or 11 is rolled, the user wins and the game is over. If any other number is rolled, this number becomes the point. Your program must continue rolling the dice until the point is rolled again, or a 7 is rolled. If the point is rolled before a 7 appears, the user wins and the game is over. If a 7 is rolled before the point is rolled, the user loses, and the game is over. More info: https://www.youtube.com/watch?v=7Vom4YWEOI0

Hint:

You can assume that the user will enter a positive integer as their bet; there is no need to do any error detection. Break the problem into smaller steps and simplify your process. You know that youll need to ask the user for a bet, but you can start by setting their bet for them (myBet = 25 instead of myBet = int(input(Enter a bet:))). Then figure out how to roll 2 die. You will want to use the randrange(1,6) function to generate the value of a single die (youll want to use it twice to generate a value for rolling 2 die). To do this, put this text on the first line of your program: from random import randrange. Once you have your first roll, figure out what to do with it. Build your program slowly.

Output

Place your bet ($): 27

Roll 1: 2 + 2 = 4

Shooters point is 4.

Roll 2: 5 + 4 = 9

Roll 3: 6 + 3 = 9

Roll 4: 1 + 1 = 2

Roll 5: 5 + 6 = 11

Roll 6: 4 + 3 = 7

Im sorry, you lost!

Your earnings: $-27

1b. Let the user continue playing until they reach the house maximum of $5000 (earnings or debt), or they choose to cash out (e.g. Place your bet ($ or type Cash out to quit)).

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions