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
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?
self.laps = 0
for key,value in kwargs.items():
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!