Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.
 === Sample Usage === Creating a spinner: >>> s = Spinner(8) >>> 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

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

ISBN: 0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

Perform an Internet search. Discuss a company that uses EPLI.

Answered: 1 week ago

Question

How do you feel about employment-at-will policies? Are they fair?

Answered: 1 week ago