Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Elisa Huertas274 Points
What are the guidelines for indentation in python? I just got this error "inconsistent use of tabs and spaces"
I see in Craig's video that spaces are set to 4. but I will also appreciate some feedback on how to approach these errors
That error happens on here sometimes when one line is tabbed while others are spaces. Sometimes I have to find the same code somewhere and copy/paste it to get past the challenge. In Python, 4 spaces is the standard, but I believe it's more about consistency rather than the exact number of spaces.
r h68,546 Points
If you are mixing tabs and spaces you are going to have to rely on a text editor to correct the mismatches, because otherwise they're invisible to your naked eye and workspaces doesn't have a prettify command.
If you get completely stuck on workspaces (there is a clickable option in the lower right to change to either tabs or spaces. Choose spaces. And you can set the number of spaces by clicking the number following "spaces" and setting it to a number), you can always install microsoft visual studio code and use it to format your code. You will need to install the "python" plugin package. Visual Studio Code too has the option in the lower right of the window to set up either spacing or tabs (choose spaces: 4) and then you can highlight the code and right click and choose "Format Selection". That will prettify your code and set up the correct spacing.
You can also do this in Atom (http://atom.io) very easily: follow the instructions here: https://stackoverflow.com/questions/41848002/how-to-replace-tabs-with-spaces-in-atom
Setting up a third party text editor and not relying on workspaces will be a challenge, but the benefits are immense. You will enjoy working in a text editor much more than working in work spaces. You'll get amazing shortcuts, code completion, and lots of ability to prettify code and all that. Atom is very good but these days I prefer Visual Studio Code because of its code completion abilities.