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 Object-Oriented Python Instant Objects Your first method

Oszkár Fehér
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Oszkár Fehér
Treehouse Project Reviewer

This one why it's not working?

In pycharm it's working perfectly, i even reduced the lines still not working

first_class.py
class Student:
    name = "Oszkar"

    def praise(self):

        return print("You're doing a great job "+self.name)
me = Student()
me.praise()

1 Answer

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

Hi there! It's not about reducing the lines, it's about following the instructions and not doing things they don't ask for. Just because code works outside of the challenge does not mean it will meet the challenges requirements.

Also, you're returning a call to the print method, instead of returning a string value. Take a look at your edited code that passes and see if you can see the difference between what you're doing and what the challenge has asked you to do. I cannot stress enough how important following instructions to the letter is going to be in going forward through these challenges.

class Student:
    name = "Oszkar"

    def praise(self):
        return "You're doing a great job "+self.name

Note the removal of the creation of instances of Student and the removal of the print method.

Hope this helps! :sparkles:

Oszkár Fehér
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Oszkár Fehér
Treehouse Project Reviewer

Thank you for the help.You are right, it's not even mentioned to print out, i am jumping forward... i am sorry for bothering. i am just new in this and alone, nobody close to ask question just from here.I am sorry again and thank you

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

Rayan White there's absolutely no need to be sorry! Most of us on here absolutely love answering questions. Seriously. I even asked a question today on the forums! The Community is an amazing place to get help. I'd be willing to bet that 99.9% of us didn't understand something the first time around :smiley:

P.S. I answer coding questions because it's not only fun, it's a great way to learn! There's nothing to test your knowledge of a subject like having to explain it to someone else. :sparkles: