Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 three rounds of the popular dice game. This game program must ask the user to determine whether to play this game with two rounds or four rounds before rolling the dice.

The rules of craps are as follows:

A player rolls two dice.

  • If the sum of dice is either 2, 4 or 7 on the first throw, the player wins.
  • If the sum is 9 on the first throw, the player loses.
  • If the sum of the two dice does not belongs to the winning numbers or the losing number, then it becomes the players target number on the first throw.
  • To win, the player must continue rolling the dice until a roll matches to this target number.

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

More Books

Students also viewed these Databases questions