I made a code for generating random values when a set of 2 die are rolled. Error says roll isn't defined. Can't figure out why it says that. I want to know what's wrong with my approach, I've already seen other solutions to the problem.
Novice programmer. My first problem related to generating random values.
import random
class Dice:
def roll(self):
roll = (1, 2, 3, 4, 5, 6)
toss = random.randint(roll)
print(toss, toss)
toss = random.randint(roll)
Error :
NameError: name 'roll' is not defined
Aucun commentaire:
Enregistrer un commentaire