+ 1

What am I doing wrong here?

So I was working on practicing inheritance, and I have this code: class practice: def __init__(self, name, type): self.name = name self.type = type patrick = practice("Patrick", "Fire") print (patrick.name) print (patrick.type) class typing: def __init__(self, name, type, attack): self.name = name self.type = type self.attack = attack fatronach = typing("Flame Atronach", "Fire", 24) from random import randint for i in range(1): i = randint(0, 10) if i==1: fatronach.attack = 10 else: print ("unfinished") print (fatronach.name) class skill(typing): def skill(self): skill = "Level " + str(fatronach.attack) print (skill) print (fatronach.skill) However it keeps producing an error saying class "type" doesn't have an attribute "skill". Can someone help me?

24th Oct 2016, 12:52 PM
Michael
Michael - avatar
1 Resposta
+ 2
since I'm just a beginner, try this: in class typing add skill Hope this helps!
24th Oct 2016, 6:34 PM
Edwin Pratt
Edwin Pratt - avatar