Python Basic Object-Oriented Python Welcome to OOP Creating a Panda Class

add __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.

panda.py
class Panda:
    species = 'Ailuropoda melanoleuca'
    food = 'bamboo'

  def __init__ (self):
    self.is_hungry == True

please assist, i keep getting indenation error directed at the colon after (self)

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi 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! :sparkles:

thank 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