Question: The function random.randint from the random module can be used to produce an integer from a range of values. For example, random.randint(1,6) produces the values

The function random.randint from the random module can be used to produce an integer from a range of values. For example, random.randint(1,6) produces the values 1 to 6 with equal probability. Such a value can be used, for example, to simulate the roll of a die.

Using this technique, write a program that will allow the user to play either two rounds or six rounds of the popular dice game known as craps. This game program must ask the user to determine whether to play this game with two rounds or six rounds before rolling the dice.

The rules of craps are as follows:

A player rolls a pair of dice.

If the sum of dice is either 3 or 8 on the first throw, the player wins.

If the sum is 2, 7 or 10 on the first throw, the player loses.

Any other sum becomes the players point on the first throw.

To win, the player must continue rolling the dice until a roll matches the point. This is termed making the point.

After the first throw, if the player rolls a 12 before making the point, the player loses.

Hint:

import random ------ used to load in the random number module for all the random functions.

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!