---
id: 69c0e73cc6f2cf16a453c69e
title: Step 29
challengeType: 20
dashedName: step-29
---

# --description--

Now that the `level` setter handles the validation for invalid levels, remove the `if level not in Employee._base_salaries` check from `__init__`. This will be handled by the setter in the next step.

# --hints--

Your `__init__` method should not contain the `level not in Employee._base_salaries` check.

```js
({ test: () => assert(runPython(`not _Node(_code).find_class("Employee").find_function("__init__").find_if("level not in Employee._base_salaries").find_body().has_stmt("raise ValueError(f\\"Invalid value '{level}' for 'level' attribute.\\")")`)) })
```

# --seed--

## --seed-contents--

```py
class Employee:
    _base_salaries = {
        'trainee': 1000,
        'junior': 2000,
        'mid-level': 3000,
        'senior': 4000,
    }

    def __init__(self, name, level):
--fcc-editable-region--
        if level not in Employee._base_salaries:
            raise ValueError(f"Invalid value '{level}' for 'level' attribute.")
--fcc-editable-region--
        self.name = name
        self.level = level
        self._salary = Employee._base_salaries[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

    @name.setter
    def name(self, new_name):
        if not isinstance(new_name, str):
            raise TypeError("'name' must be a string.")
        self._name = new_name
        print(f"'name' updated to '{self.name}'.")

    @property
    def level(self):
        return self._level

    @level.setter
    def level(self, new_level):
        if not isinstance(new_level, str):
            raise TypeError("'level' must be a string.")
        self._level = new_level

    @property
    def salary(self):
        return self._salary

charlie_brown = Employee('Charlie Brown', 'trainee')
print(charlie_brown)
print(f'Base salary: ${charlie_brown.salary}')

```
