curriculum/challenges/english/blocks/workshop-salary-tracker/68c7e19810faf3d00dba53d5.md
Create a class attribute named _base_salaries and assign it the following dictionary:
{
'trainee': 1000,
'junior': 2000,
'mid-level': 3000,
'senior': 4000
}
Your Employee class should have a class attribute named _base_salaries.
({ test: () => assert(runPython(`_Node(_code).find_class("Employee").has_variable("_base_salaries")`)) })
You should assign {'trainee': 1000, 'junior': 2000, 'mid-level': 3000, 'senior': 4000} to the _base_salaries class attribute.
({ test: () => runPython(`
assert Employee._base_salaries == {'trainee': 1000, 'junior': 2000, 'mid-level': 3000, 'senior': 4000}
`) })
--fcc-editable-region--
class Employee:
--fcc-editable-region--
def __init__(self, name, level):
if not (isinstance(name, str) and isinstance(level, str)):
raise TypeError("'name' and 'level' attribute must be of type 'str'.")
self._name = name
self._level = level
def __str__(self):
return f'{self.name}: {self.level}'
def __repr__(self):
return f"Employee('{self.name}', '{self.level}')"
@property
def name(self):
return self._name
@property
def level(self):
return self._level
charlie_brown = Employee('Charlie Brown', 'trainee')
print(charlie_brown)