curriculum/challenges/english/blocks/workshop-salary-tracker/68c28b7cc3ab8f4daf144b5e.md
Following what you did in the previous steps, create a getter for the _level attribute.
Your Employee class should have level method with a self parameter.
({ test: () => assert(runPython(`_Node(_code).find_class("Employee").find_function("level").has_args("self")`)) })
Your level method should be decorated with @property.
({ test: () => assert(runPython(`_Node(_code).find_class("Employee").find_function("level").has_decorators("property")`)) })
Your level method should return self._level.
({ test: () => assert(runPython(`_Node(_code).find_class("Employee").find_function("level").has_return("self._level")`)) })
class Employee:
def __init__(self, name, level):
self._name = name
self._level = level
def __str__(self):
return f'{self._name}: {self._level}'
--fcc-editable-region--
@property
def name(self):
return self._name
--fcc-editable-region--
charlie_brown = Employee('Charlie Brown', 'trainee')
print(charlie_brown)
print(charlie_brown.name)