Prisca Egbua1,167 Points
This code looks okay but I get "TabError: inconsistent use of tabs and spaces in indentation"
The problem occurred when I try to add a new method run_lap that takes a length as an argument, reduces the fuel_remaining attribute by length multiply by 0.125, and increment lap attribute. Please help?
class RaceCar: def __init__(self,color,fuel_remaining,**kwargs): self.color=color self.fuel_remaining=fuel_remaining self.laps = 0 for key,value in kwargs.items(): setattr(self,key,value) def run_lap(self,length): self.length = length self.fuel_remaining = self.fuel_remaining - (self.length * 0.125) self.laps = self.laps + 1
Jennifer NordellTreehouse Teacher
Hi there! The error you are getting is indicative of mixing tabs and spaces in the same file, which you may not do in Python. You may not indent with tabs on one line and then indent with spaces on the next. This is built-in to Python and it's because Python is dependent upon whitespace to know what constitutes the beginning and ending of a block of code. Go back through your code and make sure you either use all tabs or all spaces for indentation.
Hope this helps!