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

Hanwen Zhang
Hanwen Zhang
15,509 Points

Why code is not working here?

class Panda(): def initial(self, species, food): self.make = make self.model = model

print(Panda(‘Ailuropoda melanoleuca’, ‘bamboo’))
panda.py
# insert your code here

class Panda():
    def __initial__(self, species, food):
  self.make = make
  self.model = model

    print(Panda(Ailuropoda melanoleuca, bamboo))

1 Answer

Hi Hanwen!

How are you?

Well, I hope!

This is the way to code both tasks (to pass):

# insert your code here

class Panda:
    species = 'Ailuropoda melanoleuca' # Task 1
    food = 'bamboo' # Task 1

    def __init__(self): # Task 2
        self.is_hungry = True # Task 2

Even though using a print statement to see results in the real world is a good idea, adding one to the challenge code will break it!?!

Also, use init not initial...

I hope that helps.

Stay safe and happy coding!