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 trial

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

Anthony Costanza
Anthony Costanza
2,123 Points

Not really sure why I'm failing

Create a class called Panda. Inside your class, create two class attributes. One called species set to ‘Ailuropoda melanoleuca’ and another called food set to ‘bamboo’. Bummer: AssertionError: 'class Panda' not found in '# insert your code here\n\nClass Panda:\n \n def intit(self, species, food):\n self.species = species\n self.food = food\n \npanda_one = Panda()\npanda_two = Panda()' : Creating a class should start with the class keyword and then the name of your class, Panda. RestartGet HelpCheck Work panda.py

1

insert your code here

2 ​ 3 Class Panda: 4

5 def intit(self, species, food): 6 self.species = species 7 self.food = food 8

9 panda_one = Panda() 10 panda_two = Panda() 11

panda.py
# insert your code here

Class Panda:

    def __intit__(self, species, food):
        self.species = species
        self.food = food

panda_one  = Panda()
panda_two = Panda()

2 Answers

Hi Anthony!

This passes both tasks:

# insert your code here
class Panda:
    species = 'Ailuropoda melanoleuca'
    food = 'bamboo'

    def __init__(self):
        self.is_hungry = True

I hope that helps.

Stay safe and happy coding!