'No error detected... but if run module don't get output
#generatore di dadi per risultati casuali
class dado:
materiale = 'plastica'
def __init__ (self, facce = 8):
self.risultato = 0
self.facce = facce
tipi = [4, 6, 8, 10, 12, 20]
if facce not in tipi:
print(f'mai sentito di dati con {facce} facce!!')
elif facce !=6 :
print(f'stai giocando a d&d')
else:
print(f'un classico dado a facce {facce} ')
def tira (self):
from random import randint
print(f'tiro il dado a {self.facce} facce..!!')
self.risultato = randint(1, self.facce)
print(f'il risultato è {self.risultato}')
def leggi (self):
if not self.risultato:
print('non hai ancora tirato il dado..!!')
else:
print(f'il dado mostra {dado.risultato} punti.')
No error detected but there's no output when the code is run.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
