Question: PYTHON Craps is a dice-based game played in many casinos. Like blackjack, a player plays against the house. The game starts with the player throwing

PYTHON

Craps is a dice-based game played in many casinos. Like blackjack, a player plays against the house. The game starts with the player throwing a pair of standard, six-sided dice. If the player rolls a total of 7 or 11, the player wins. If the player rolls a total of 2, 3, or 12, the player loses. For all other roll values, the player will repeatedly roll the pair of dice until either she/he rolls the initial value again (in which case she/he wins) or 7 (in which case she/he loses).

1. Write a function craps that takes no parameters, simulates one game of craps, and returns 1 if the player won and 0 if the player lost. It should also print a history of the rolls so that the player can verify that the function is doing the right thing. The following shows several sample runs of the function:

>>> random.seed(1)

>>> craps()

2 5

1

>>> random.seed(2)

>>> craps()

1 1

0

>>> random.seed(9)

>>> craps()

4 5

3 3

2 2

6 1

0

>>> random.seed(7)

>>> craps()

3 2

4 6

1 1

5 1

3 5

1 5

2 1

1 4

1

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!