Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 Exercise-3 Create a function to roll a dice and utilize it to develop a game of chance as described below: A player rolls iwo

image text in transcribed
2 Exercise-3 Create a function to roll a dice and utilize it to develop a game of chance as described below: A player rolls iwo dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5 and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated and printed. If the sum is 7 or 11 on the first throw, the player wins and the game is over If the sum is 2, 3 or 12 on the first throw (called "craps"), the player loses (ie, the "house" wins) and the game is over. If the sum is 4, 5, 6, 8, 9 or 10 on the first throw, then that sum becomes the player's "pointand the game continues until the player wins or loses. To win, you must continue rolling the dice until you make your point", ie, the sum is identical to your point in the first throw. The player ioses by rolling a 7 before making the point. Note: utilize function random.randrange to create a function to roll a dice. [1: # demonstration on how to use the randon.randrage funtion Import random die1 = random.randrangel 1, 7) die2 = random.randrange 1, 7) 1: Mode: Command int Colt Labod yn Saving completed elv 4 MacBook Pro

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

DB2 11 The Ultimate Database For Cloud Analytics And Mobile

Authors: John Campbell, Chris Crone, Gareth Jones, Surekha Parekh, Jay Yothers

1st Edition

1583474013, 978-1583474013

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago