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 Master Class

please help me in solving the code

i am unable to solve the code

racecar.py
class RaceCar:
    colour=""
    fuel_remaining=""
    def __init__(self,c,b,):
        self.colour=c
        self.fuel_remaining=b
r=RaceCar()
setattr(r,"__init__","blue","no")

1 Answer

Steven Parker
Steven Parker
231,261 Points

Here's a few hints:

  • the instructions ask for an attribute named "color" instead of "colour"
  • the "setattr" should be done inside the "__init__" method
  • "setattr" is to help set keyword arguments passed in, not anything specific to an instance
  • you only need to define the class, you don't need to create an instance of it

thank you