14/18 PartTimeEmployee Not Defined


#1

Hi, I’m getting a weird error that I can’t seem to get around. I’ve compared my code to a bunch of others here and for all intents and purposes it should pass but for some reason it seems to think that PartTimeEmployee is not defined.

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

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

Getting this error:

Traceback (most recent call last):
  File "python", line 11, in <module>
  File "python", line 19, in PartTimeEmployee
NameError: name 'PartTimeEmployee' is not defined

#2

It hasn’t been defined at that time. Look at when/where you try to use it


#3

Foiled by indentations…Thanks for the reality check. Passed it!


#4

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