Ошибка: AttributeError: type object 'Test' has no attribute 'info'
Помогите, не знаю как исправить ошибку :
class Test:
def __init__(self, name, age):
self.name = name
self.age = age
class Rabochiy(Test):
def __init__(self, name, age, salary, country, past):
Test.__init__(self, name, age)
self.past = past
self.country = country
self.salary = salary
print('it\'s {}, he is {} years old\nHis salary is {} uah'.format(name, age, self.salary))
def info(self):
Test.info(self)
print('{} has leaved in {} and at {} yars old he has worked as a {}'.format(self.name, self.age, self.past))
r = Rabochiy('Nikolai', 37, 4000, 'San Francisco', 'courier')
l = [r]
for i in l:
i.info()
Ответы (1 шт):
Автор решения: DeMeNToR
→ Ссылка
Держи, сравни коды
class Test:
def __init__(self, name, age):
self.name = name
self.age = age
class Rabochiy(Test):
def __init__(self, name, age, salary, country, past):
Test.__init__(self, name, age)
self.past = past
self.country = country
self.salary = salary
print('it\'s {}, he is {} years old\nHis salary is {} uah'.format(name, age, self.salary))
def info(self):
print('{} has leaved in {} and at {} yars old he has worked as a {}'.format(self.name, self.country, self.age, self.past))
r = Rabochiy('Nikolai', 37, 4000, 'San Francisco', 'courier')
l = [r]
for i in l:
i.info()
Я убрал строчку Test.info(self) и добавил аргумент в строчку ниже(ты скобок{} поставил 4,а аргументов дал 3))