What is wrong with my code?


Continuing the discussion from 14/18 This Looks Like a Job For:

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(self,hours)
            milton = PartTimeEmployee("milton")
            print milton.full_time_wage(40)

I get this error message: Oops, try again. Did you create an instance of the PartTimeEmployee class called milton?


Please always format your code - discuss.codecademy.com/t/using-backticks-to-format-your-code/3697/2 Thanks! :smiley:

Here's what's wrong with your code:

  1. PartTimeEmployee class block should be indented outside the Employee class block.
  2. Last two statements regarding milton should be outside the PartTimeEmployee class block.

  3. This line:

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

should be:

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

you do not self as an argument.