Aug-27-2018, 02:29 PM
class Person: def __init__(self, first, last, fathers_name, age): self.first = first self.last = last self.fathers_name = fathers_name self.age = age def fullname(self): return '{} {} {}'.format(self.first, self.last, self.fathers_name) class Student(Person): def __init__(self, first, last, fathers_name, age, grade, avg_mark): super().__init__(first, last, fathers_name, age) self.grade = grade self.avg_mark = avg_mark class Workers(Person): def __init__(self, fisrt, last, fathers_name, age, positon, pay, wrk_exp): super().__init__(first, last, fathers_name, age) self.position = position self.pay = pay self.wrk_exp = wrk_exp person_1 = Person('Микола', 'Кучварський', 'Миколайович', 56) fullname(person_1)
Error:Traceback (most recent call last):
File "C:/Users/user/AppData/Local/Programs/Python/Python37-32/School 1.py", line 26, in <module>
fullname(person_1)
NameError: name 'fullname' is not defined
so I`m learning Python OOP and currently Im on classes, now I have this problem, any idea why it does it ?