Question: Using Python 3.8 to complete the following tasks. Please give a screenshot of the answers. Thank you very much. === Module Description === This module

Using Python 3.8 to complete the following tasks. Please give a screenshot of the answers. Thank you very much.

=== Module Description === This module contains the documentation for a simple class. Your job is to implement the class below according to its docstring; note this includes both the *instance attributes* of the class and the *methods* we've documented. As usual, delete the TODO comments after you've completed each part. There is also a task inside prep2_starter_tests.py. Make sure to look at that file and complete the TODO there as well. """ # Do NOT use any imports beyond this one (randint)! from random import randint class Spinner: """A spinner for a board game. A spinner has a certain number of slots, numbered starting at 0 and increasing by 1 each slot. For example, if the spinner has 6 slots, they are numbered 0 through 5, inclusive. A spinner also has an arrow that points to one of these slots. === Attributes === slots: The number of slots in this spinner. position: The slot number that the spinner's arrow is currently pointing to. === Sample Usage === Creating a spinner: >>> s = Spinner(8) >>> s.position 0 Spinning the spinner: >>> s.spin(4) >>> s.position 4 >>> s.spin(2) >>> s.position 6 >>> s.spin(2) >>> s.position 0 """ slots: int position: int def __init__(self, size: int) -> None: """Initialize a new spinner with  slots. A spinner's position always starts at 0. Precondition: slots >= 1 """ # TODO: complete this method! pass def spin(self, force: int) -> None: """Spin this spinner, advancing the arrow  slots. The spinner wraps around once it reaches its maximum slot, starting back at 0. See the class docstring for an example of this. Precondition: force >= 0. Hint: use the "%" operator to "wrap around" the spinner's position. """ # TODO: complete this method! pass def spin_randomly(self) -> None: """Spin this spinner randomly. This modifies the spinner's arrow to point to a random slot on the spinner. Each slot has an equal chance of being pointed to. You MUST use randint (imported from random) for this method, to choose a random slot. """ # TODO: complete this method! pass 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!