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 __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?

first_class.py
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
MOD
Chris Freeman
Treehouse Moderator 67,989 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
STAFF
Ken Alger
Treehouse Teacher

Ian;

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,
Ken

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

[MOD: removed swearing]