Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Object-Oriented Python Instant Objects Method Interactivity

Getting this error Exception: argument of type 'NoneType' is not iterable Not sure whats wrong here.

What am i doing wrong here? Exception: argument of type 'NoneType' is not iterable

I wish there was more explanation on when to use self and when not to use self.

class Student:
    name = "Sachin"

    def praise(self):
        return "You inspire me, {}".format(self.name)

    def reassurance(self):
        return "Chin up, {}. You'll get it next time!".format(self.name)

    def feedback(self, grade):
        if grade > 50:

1 Answer

Micah Hack
Micah Hack
12,902 Points

Hello Sachin,

You're very close. You have the right idea. The self in your method calls is correct. The purpose of self is tell your class where to find the method you are calling. Your feedback method is calling praise and reassurance, but you have not specified it to do anything with the results.

I believe you are receiving the "'NoneType' object is not iterable error", because the value of the data is "None" due to it not being returned to the method.

In short all you need to do is "return" the result of the praise method as well as "return" the reassurance method's result.

I hope this helps. This is my first time attempting to answer a question, lol!

Thank you Micha, That helped and fixed my issue.