14/18 PartTimeEmployee Not Defined


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


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


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


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