This Looks like a Job


#1

hi all,
i am getting the following error

Traceback (most recent call last):
File "python", line 21, in
File "python", line 16, in full_time_wage
TypeError: must be type, not classobj


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


I expected this to work but feel that i did some small mistake which i can't figure out
line 16 is return super(PartTimeEmployee,self).calculate_wage(hours)


class Employee:
    """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):
        self.hours = 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(8)


#2

The only possible issue I can see is that the Employee class does not indicate any parentage. What built in class is it supposed to inherit from?

class Employee(object):

#3

Thanks.
That worked , i initially used Employee(object) but read somewhere that class Employee also works.. so started using.. now i get .. for inheritance we need class newclass(object).

Thanks again


#4

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