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 Design

Adam Rubinson
Adam Rubinson
4,286 Points

Master Class Q1 ??

I completed Q1 of Master Class challenge set the other day.

Now when I answer Q1 the same as before, it comes up with an error:

"Bummer! Couldn't find the RaceCar class".

Help much appreciated.

Adam Rubinson
Adam Rubinson
4,286 Points

class RaceCar:

def __init__(self, color, fuel_remaining, **kwargs):
    self.color = color
    self.fuel_remaining = fuel_remaining

for key, value in kwargs.items():
    setattr(self, key, value)
nakalkucing
nakalkucing
12,964 Points

Hey, are you still having trouble with this? If so, could you please include your whole code? Thanks. :)

5 Answers

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

Hi Adam, So I checked your code, the problem is the indentetion

class RaceCar:
    def __init__(self, color, fuel_remaining, **kwargs):
        self.color = color
        self.fuel_remaining = fuel_remaining

        for key, value in kwargs.items():
            setattr(self, key, value)

In your code the for loop it is in the same column as the function, it should be inside the init function, like above. If you still have issues please let me know. I hope this will help you. Happy coding

Adam Rubinson
Adam Rubinson
4,286 Points

Thanks, can't believe I missed this!

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

Interesting, i tried to but it's not working. i think it's something wrong in there end. write to support.

Adam Rubinson
Adam Rubinson
4,286 Points

Hi can someone please help me with this? I really want to continue with this course asap. The error still exists

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

The functions are inside the class because like this i can't figure out?Here there is just 2 functions with a class title

Temi Folorunsho
Temi Folorunsho
2,849 Points

I had the same problem but, when i compared with @Oszkhar Feher i saw that there is a space between the def and init. I hope this helps