Help with super


calculate_wage() takes exactly 2 arguments (1 given)

with super the method calculate wage is taken from base class (Employee). So expected value*20 to be returned.

class Employee(object):
    """Models real-life employees!"""
    def __init__(self, employee_name):
        self.employee_name = employee_name

    def calculate_wage(self, hours):
        self.hours = hours
        return hours * 20.00

# Add your code below!
class PartTimeEmployee(Employee):
    def calculate_wage(self,hours):
        return hours*12.00
    def full_time_wage(self,hours):
        return super(PartTimeEmployee,self).calculate_wage()




Hi @a1301 ,

You have ...

    def full_time_wage(self,hours):
        return super(PartTimeEmployee,self).calculate_wage()

... but you need to pass hours to the calculate_wage method in the return statement.


Hi thank you for your help.
Am I right in concluding that super only calls the method form the base class without the arguments listed in it?
Will I have to provide argument whenever I use super?


Hi @a1301 ,

To determine what arguments you need to use when you use super, look at the header of the method that is being called in the base class. For example, the following is correct code for the return statement in the full_time_wage method of the PartTimeEmployee class ...

return super(PartTimeEmployee, self).calculate_wage(hours)

In that statement, the call to calculate_wage refers to the method in the Employee class that has this header ...

def calculate_wage(self, hours):

The two parameters of that method are self and hours. In the return statement cited above, the self parameter of Employee's calculate_wage method receives a reference to the object, super(PartTimeEmployee, self). Now, we need to consider an argument that takes care of the hours parameter of Employee's calculate_wage method. That argument should be hours, which passes the value used to perform this calculation in Employee's calculate_wage method ...

return hours * 20.00


Thank you for the insight.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.