MCPcopy Create free account
hub / github.com/geekcomputers/Python / roll

Method roll

dice.py:30–32  ·  view source on GitHub ↗

Returns a random integer between 1 and the number of sides.

(self)

Source from the content-addressed store, hash-verified

28 print(f"Invalid input: {num_sides}. Keeping current value: {self.sides}")
29
30 def roll(self):
31 """Returns a random integer between 1 and the number of sides."""
32 return random.randint(1, self.sides)
33
34# --- Example Usage ---
35if __name__ == "__main__":

Callers 1

dice.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected