Question: The game of craps has a lot of complexity, but the basic structure is fairly simple. In this project, you will code a crap simulation.

The game of craps has a lot of complexity, but the basic structure is fairly simple. In this project, you will code a crap simulation. (Don't worry if you have never played the game of craps. The instructions below can be followed even if you don't know all the rules of the game.)

  1. Write a Python program in a .py file that includes the following:
    1. First, roll two six-sided dice (use variables and the random number generator) and store the sum in a variable.
    2. If the sum is 7 or 11, print a message that the player is a winner in one roll of the dice.
    3. If the roll is a 2, 3, or 12, print a message that the player is a loser in one roll of the dice.
    4. For any other number, the player has established a "point". Continue to roll and sum the dice (print the sum for each roll) until either a 7 occurs or the point sum occurs a second time.
    5. If the roll now is a 7, print a loser message with the total number of rolls.
    6. If the point sum is rolled, print a winning message with the total number of rolls.

r

Step by Step Solution

3.39 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import random def gameofcraps to generate two random number in range of 07 n1 randomrandrange07 n2 randomrandrange07 sum n1 n2 print if sum 7 or sum11 ... View full answer

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 Computer Engineering Questions!