May-22-2020, 12:41 PM
hi i'm lerning classs, trying to rool a dice
this is what i wirted
with it help plasea.
Dice: Make a class Die with one attribute called sides, which has a default value of 6. Write a method called roll_die() that prints a random number between 1 and the number of sides the die has. Make a 6-sided die and roll it 10 times.
Make a 10-sided die and a 20-sided die. Roll each die 10 times.
this is what i wirted
from random import randint class die(): def __init__(self,sides): self.sides = sides def rool_die(self): randint(1,self.sides) dice = die(6) dice.rool_die() dice2 = die(10) dice2.rool_die() dice3 = die(20) dice3.rool_die()but the out put get nothing , im stoke

Dice: Make a class Die with one attribute called sides, which has a default value of 6. Write a method called roll_die() that prints a random number between 1 and the number of sides the die has. Make a 6-sided die and roll it 10 times.
Make a 10-sided die and a 20-sided die. Roll each die 10 times.