Introduction To Classes/14. This looks like a job for


#1

Hey everyone!

I recently started learning about classes in Python by way of Codeacademy. I am on Lesson 14 of Introduction to Classes, titled "This looks like a job for..." I'm running into the following error with my code:
<bound method PartTimeEmployee.full_time_wage of <PartTimeEmployee object at 0x7f460c8da290>>

My code is as follows:

class Employee(object):
    def __init__(self, employee_name):
        self.employee_name = employee_name

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

class PartTimeEmployee(Employee):
    def calculate_wage(self,hours):
        self.hours=hours
        return hours*12.00
    def full_time_wage(self,hours):
        return super(calculate_wage,self).method(self,hours)

milton = PartTimeEmployee(10)
print milton.full_time_wage

Any ideas on how to fix it? Anything you have would be appreciated. Thanks!

Click here to send a direct email to me.


#2

i think in this part you wanna define calculate_wage inside class Employee so you forget to indent correctly the function , if not reply to me
sorry also you have to print out the result of calling his full_time_wage method. You should see his wage printed out at $20.00 per hour! (That is, for 10 hours, the result should be 200.00.)
give that function an argument ( number of hour)


#3

@azazaz I forgot to say. Code editor for post wasn't working so I didn't indent. But it is intended properly.


#4

Ok , so did you try to give full_time_wage an argument ( number of hour) ??


#5

this reference to upper class has wrong syntax, you should reference to child class and mention the arguments with self. like this:
super(PartTimeEmployee, self).calculate_wage(hours)
so it will for child class specified in parameter call the parent class method with argument hours.