Answered You can hire a professional tutor to get the answer.

QUESTION

Using Python solve the following question Craps is a dice-based game played in many casinos. Like blackjack, a player plays against the house.

Using Python solve the following question 

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 rolls the initial value again (in which case she wins) or 7 (in which case she loses)

(a) Implement function craps() that takes no argument, simulates one game of craps, and returns 1 if the player won and 0 if the player lost.

>>> craps()

0

>>> craps()

1

>>> craps()

1

(b) Implement function testCraps() that takes a positive integer n as input, simulates n games of craps, and returns the fraction of games the player won. >>> testCraps(10000)

0.4844

>>> testCraps(10000)

0.492

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question