Tell us what’s happening:
Step 19, the last step, is not passing. I am being asked to call the orbit method on each of the planet objects and print them afterwards. I have done that, and I am getting no terminal erros, and the prints has printed out what they should
Your code so far
class Planet:
def __init__(self, name, planet_type, star):
if not isinstance(name, str):
raise TypeError(f'name, planet type, and star must be strings')
if not isinstance(planet_type, str):
raise TypeError('name, planet type, and star must be strings')
if not isinstance(star, str):
raise TypeError('name, planet type, and star must be strings')
if name == '':
raise ValueError('name, planet_type, and star must be non-empty strings')
if planet_type == '':
raise ValueError('name, planet_type, and star must be non-empty strings')
if star == '':
raise ValueError('name, planet_type, and star must be non-empty strings')
self.name = name
self.planet_type = planet_type
self.star = star
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('Mars','Terrestrial','Sun')
print(planet_1)
orbit_1 = planet_1.orbit()
print(orbit_1)
planet_2 = Planet('Earth','Terrestrial', 'Sun')
print(planet_2)
orbit_2 = planet_2.orbit()
print(orbit_2)
planet_3 = Planet('Venus', 'Terrestrial','Sun')
print(planet_3)
orbit_3 = planet_3.orbit()
print(orbit_3)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
Challenge Information:
Build a Planet Class - Build a Planet Class