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

Alexis Suberville
Alexis Suberville
1,455 Points

Quiz solutions for the Object-Oriented Python course?

Having issues with most of the quizzes in the Object-Oriented Python intro course... can you share the solutions, I can't figure out what I am doing wrong.

boi
boi
14,242 Points

Show me the quizzes you have a problem with, I'll explain them.

Alexis Suberville
Alexis Suberville
1,455 Points

The second quiz of the object-oriented python beginner course. The prompt is:

First, I need you to add a method named praise to the Student class. It should take the self argument. Then, inside the praise method, return a positive message about the student using the name attribute. As an example, it could say "You're doing a great job, Jacinta!" or "I really like your hair today, Michael!". Feel free to change the name attribute to your own name, too!

My answer so far is:

class Student:
    name = "Alexis"

    def praise(self, name):
        return ("You're doing a great job, {}!".format(name))

Not sure what i'm missing - the error message is "Bummer: Oh no! You forgot the self argument in your praise method" Thanks!

1 Answer

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

Hi there, Alexis Suberville! That method only needs to take self. The name attribute is defined on the Student. So assuming you only sent in self, you should be able to format that string with self.name as opposed to just name.

It's wanting a:

def praise(self):

Then you should be able to use self.name in the formatting of that string.

Hope this helps! :sparkles: