Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTafadzwa Mandimika
2,667 Pointsadd __init__
Add an init method to your class. It should only take the self argument. Inisde the method, create an instance attribute called is_hungry and set it equal to True.
class Panda:
species = 'Ailuropoda melanoleuca'
food = 'bamboo'
def __init__ (self):
self.is_hungry == True
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Tafadzwa Mandimika! Your def __init__(self):
is supposed to be in line with species
and food
. It's over to the left a bit too far. Move it over to the right.
Hope this helps!
Tafadzwa Mandimika
2,667 Pointsthank you so much Jennifer Nordell i managed to pass, im on the next challenge "Using your Panda class, add two arguments to your class in the init method called name and age. Set the values inside of the init method using self.
i know im close, dont know what im missing. heres my code class Panda: species = 'Ailuropoda melanoleuca' food = 'bamboo' def init(self, name, age,): self.is_hungry= True self.name = name self.age = age
Tafadzwa Mandimika
2,667 PointsTafadzwa Mandimika
2,667 Pointsplease assist, i keep getting indenation error directed at the colon after (self)