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 trialAvernell Christopher Melikhov
Data Analysis Techdegree Graduate 13,878 PointsHelp with fixing errors with this code. Particularly indentation. Is there a rule to avoid indentation errors.
Here is an example of the code https://w.trhou.se/hztbtykfnx
2 Answers
Steven Parker
231,269 PointsRemember that in Python, indentation isn't just for readability like in most languages. It identifies blocks of code such as the body of a loop or the content of a conditional.
Always be consistent with the depth of the indentation. You allowed to pick this yourself; but if you don't have a strong reason to use something else, the PEP 8 standard of 4 spaces per level is highly recommended.
Refer to the PEP 8 documentation for more suggestions and examples of proper indentation.