With this code I want to generate a tuple of random numbers. I know that there are easy ways to do it without using classes but I want the code to have class too.
import random
class Dice:
def roll(self):
generate = random.randint(1, 6)
generate2 = random.randint(1, 6)
return generate, generate2
dice = Dice
print(dice.roll())
It generates this error:
print(dice.roll())
TypeError: roll() missing 1 required positional argument: 'self'
and when I change my code like this : print(dice.roll(self)) it creates another error that the self name is not defined.