Tell us what’s happening:
what exactly is the problem here? im failing every test and i dont get why, i suspect its because of the for loop i use to check if the attributes are valid but im not sure, any help?
Your code so far
class Planet:
def __init__(self, name, planet_type, star):
self.name = name
self.planet_type = planet_type
self.star = star
attributes_to_check = (name, planet_type, star)
for attribute in attributes_to_check:
if attribute is not isinstance(attribute, str):
raise TypeError("name, planet type, and star must be strings")
return
elif attribute == False:
raise ValueError("name, planet_type, and star must be non-empty strings")
return
def orbit(self):
return f"{self.name} is orbiting around {self.star}..."
def __str__(self):
return f"Planet: {self.name} | Type: {self.planet_type} | Star: {self.star}"
planet_1 = Planet("Earth", "Terran", "Sol")
planet_2 = Planet("Mars", "Barren", "Sol")
planet_3 = Planet("Kepler-1b", "Barren", "Proxima_Centauri")
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0
Challenge Information:
Build a Planet Class - Build a Planet Class