can sub classes have attributes in addition to those they inherit from the master class that aren't methods. class A class B (A, | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can sub classes have attributes in addition to those they inherit from the master class that aren't methods. class A class B (A,

22nd Jun 2020, 4:18 PM
kbeach
kbeach - avatar
3 Answers
0
when I try this Class A let say Class(B, legs) I get an error
22nd Jun 2020, 4:38 PM
kbeach
kbeach - avatar
0
class human: planet = "Earth" def __init__(self,race,language): self.race = race self.language = language class vincentian(human): location = "Caribbean" country = "St.Vincent and the Grenadines" def attitude(self): print("amazing") def village(self): village = input("user input: ") print(village) kem = vincentian("black","English",) print(kem.planet) print(kem.race)
22nd Jun 2020, 6:30 PM
kbeach
kbeach - avatar
0
I wanted to give Vincent an attribute village so I tried class vincentian(human,village) then I tried class vincentian(human) __init__(self, village) with self.village = village didn't work
22nd Jun 2020, 6:33 PM
kbeach
kbeach - avatar