Question: Create a class to represent one Die. The initializer should allow you to specify how many sides the die has. The initializer should also include
Create a class to represent one Die.
The initializer should allow you to specify how many sides the die has.
The initializer should also include an instance attribute to store the die's current face value.
Create an instance functionvaluethat returns the current face value of the die.
Create an instance function roll that simulates rolling the die to randomly create a value based on the number of sides.
Hint where do you store this value?
Code the following instance functions. These instance methods allow comparison between two dice.
str
repr
eq
ne
lt
gt
le
ge
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
