Build a Salary Tracker - Step 14

Tell us what’s happening:

Need help checking my code i am doing the python course and need help passing this step; here is a snippet of what i used: if any(not isinstance(n, str) for n in [name, level]):
raise TypeError(“‘name’ and ‘level’ attribute must be of type ‘str’.”)
it seems correct only that it wont pass the test

Your code so far

class Employee:

# User Editable Region

    def __init__(self, name, level):
        if any(not isinstance(n, str) for n in [name, level]):
            raise TypeError("'name' and 'level' attribute must be of type 'str'.")
      

        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/146.0.0.0 Safari/537.36

Challenge Information:

Build a Salary Tracker - Step 14

Welcome to the forum @ekz_dee !

Try testing without using a list comprehension.

Happy coding!

Thanks man

Have a great day