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 trialWaqas Meer
Courses Plus Student 362 Pointsplease help me in solving the code
i am unable to solve the code
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
231,261 PointsHere'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
Waqas Meer
Courses Plus Student 362 PointsWaqas Meer
Courses Plus Student 362 Pointsthank you