Build a Salary Tracker - Step 16

Tell us what’s happening:

What is wrong with my code? I think it satisfies the requirement for the step that checks whether level is in _base_salaries or not

Your code so far

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

# User 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'.")
        if not level in Employee._base_salaries:
            raise ValueError(f"Invalid value '{level}' for 'level'")
        
        self._name = name
        self._level = level

# User Editable Region

    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)

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build a Salary Tracker - Step 16

I have already reset the code and pasted that if statement again if anyone was going to suggest that - still getting the same error

Hi @niladrideb ,

Check that your message matches the instructions.

Happy coding!