Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

you will write a program which does the following: Creates two instances of a die (i.e. a pair of dice). It will roll each of

you will write a program which

does the following:

Creates two instances of a die (i.e. a pair of dice).

It will roll each of the dice

It will retrieve the current face-up values of the dice.

It will display each of the dice after they have been rolled.

It will also display the sum of the two dice.

Finally, it will ask you if youd like to roll the dice again. Write this in python, it is similar to the coin class below

image text in transcribed

1 inport randon The Coin elasa sinalates a eoin ehat ean # be flipped. 6 elass Coin: eniEethod initializes the 9sideup data attribute with 'Beads". 10 11 de init lf 12 13 14 15 16 17 10 19 20 21 selt..-side:ap Beads. " The toss nethod generates a randon nanber in tho range of 0 through 1. If the number is o, thea sideup is set to Heads # Otherwise, sidaup is set toTails'. def tosa(self) it 1 ) "Heads. randon. rardint [o, -- self.--aldeup else1 self. ideup-Taile 23 24 25 The get eiaup nethod returns the value 2 reterenced by eideup 27 det get sideuptself) 29 return self.sidoup

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_2

Step: 3

blur-text-image_3

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago