¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
can sub classes have attributes in addition to those they inherit from the master class that aren't methods. class A class B (A,
3 Respuestas
0
when I try this Class A let say Class(B, legs) I get an error
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)
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