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 __init__

Ian Cole
Ian Cole
454 Points

Treehouse gives bummer for __init__ problem, I can't seem to find the issue with it

The specific issue is with __init__ and Treehouse is giving a bummer. I can't find the issue with my code though. I took the code to the IDLE and nothing is wrong with it, working just as it should. Am I missing a direction here? Or maybe this solution only works with one type of input?

class Student:
    name = "Your Name"

    def __init__(self, name, **kwargs):
        self.name = name
        for key, value in kwargs.items():
            setattr(self, key, value)

    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:
            return self.praise()
        return self.reassurance()

3 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Cutting and pasting your formatted code does pass. However, looking at the source of your post, the raw text mixes spaces and tabs. This causes the real error:

  File "<string>", line 6
    for key, value in kwargs.items():
TabError: inconsistent use of tabs and spaces in indentation
Ken Alger
Ken Alger
Treehouse Teacher


Your code posted above passes the challenge just fine on my end. Perhaps trying it again. Maybe there was a glitch in the system when you tried it previously.

Happy coding,

[explative deleted] yyaa i am also facing the same problem dude ... can't find any mistake

[MOD: removed swearing]