Guys, I'm trying to figure out how to inherit, and I can't figure out how to override the get_extra_mony() method from the parent Student class in the inherited Warden() class.
What needs to be done to add a simple print() to this method? I tried to start by redefining __init__ in the Warden class like this: Student.__init__(self,extra_mony) .
Paycharm extra_mony underscores the red variable and writes the error AttributeError: 'Warden' object has no attribute 'extra_mony'. In other sources, they write that you need to use the super() method.
class Student(): def __init__(self,extra_mony): self.extra_mony = extra_mony self.tax = 5 def set_extra_mony(self,extra_mony): self.extra_mony = extra_mony def set_tax(self,tax): self.tax = tax def get_tax(self): return self.tax def get_extra_mony(self): my_tax = self.extra_mony / 100 finnaly_tax = my_tax*self.tax print('cтепендия минус налог:',self.extra_mony- finnaly_tax,'грн') return self.extra_mony - finnaly_tax class Warden(Student): def __init__(self,count_people): self.count_people = count_people Student.__init__(self,extra_mony)