15/06/04 22:10:08.62 6dpaJYI0.net
>>> class Dice1:
... def __init__(self):
... face_num = 6
... print('初期化OK')
... def shoot(self):
... random.randint(1,self.face_num)
...
>>> b = Dice1()
初期化OK
>>> b.shoot()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 6, in shoot
AttributeError: Dice1 instance has no attribute 'face_num'
なんでエラーになってしまうのでしょうか?