This looks like a job for... Please help!


#1

https://www.codecademy.com/courses/python-intermediate-en-WL8e4/2/4?curriculum_id=4f89dab3d788890003000096

Traceback (most recent call last):
File "python", line 20, in
File "python", line 17, in full_time_wage
TypeError: calculate_wage() takes exactly 2 arguments (3 given)

Don't understand how I'm giving three arguments. Help?

    def calculate_wage(self, hours):
        self.hours = 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(10)



#2

self is implicitly the first argument, if you removed hours then both the first and second received arguments would be self


#3

How could I resolve this?


#4

One argument is sent too many times -> remove one occurrence of that argument


#5

remove the self. so, it will turn like this:

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


#6

Here is the correct code:

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(hours)

milton = PartTimeEmployee("Milton")
print milton.full_time_wage(10)


#7

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