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.)
- Write a Python program in a .py file that includes the following:
- First, roll two six-sided dice (use variables and the random number generator) and store the sum in a variable.
- If the sum is 7 or 11, print a message that the player is a winner in one roll of the dice.
- If the roll is a 2, 3, or 12, print a message that the player is a loser in one roll of the dice.
- 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.
- If the roll now is a 7, print a loser message with the total number of rolls.
- 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
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
Get step-by-step solutions from verified subject matter experts
