Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please this function for python 3.5 and please I dont want any answers from the user Anonymous because all his are incoreect Craps is a

please this function for python 3.5 and please I dont want any answers from the user Anonymous because all his are incoreect

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).

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

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

Beyond Greed And Fear Understanding Behavioral Finance And The Psychology Of Investing

Authors: Hersh Shefrin

1st Edition

0195161211, 978-0195161212

Students also viewed these Databases questions