Build a Planet Class - Build a Planet Class

Tell us what’s happening:

I am unable to pass step 5, but it passes steps 4 and 6. I have tried checking individually for each one if they are not a string instance and it still did not work. If I try passing in a non string input into each parameter one at a time it does what it is supposed to for each one, and raises the TypeError with the correct message, but still does not pass the test.

Your code so far

class Planet():
    def __init__(self, name, planet_type, star):
        info = {name, planet_type, star}
        if any(not isinstance(i,str) for i in info):
            raise TypeError("name, planet type, and star must be strings")

Your browser information:

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

Challenge Information:

Build a Planet Class - Build a Planet Class

in the browser console appear this error TypeError: unhashable type: 'list', it looks like what you are trying to do with {name, planet_type, star} is not allowed with some of the invalid data types this is tested with

do you really need to do this with a set?

1 Like

I tried this earlier and it did not work, but I just tried it again now and it worked. Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.