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

Python

Not sure why i'm getting an IndentationError

I keep having an issue with this code, I read you're unable to mix spaces with tabs in python so I have tried using them both separately and I'm still receiving same issue.

treehouse:~/workspace$ python
\Python 3.5.0 (default, Jun 21 2017, 00:26:31)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.

age = 22000
if age > 20000:
... if not age > 25000:
... print("Whippersnapper")
File "<stdin>", line 3
print("Whippersnapper")
^
IndentationError: expected an indented block

Steven Parker
Steven Parker
243,656 Points

Your indentation can't be seen unless you format your posted code. Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:

2 Answers

Steven Parker
Steven Parker
243,656 Points

Just guessing, based on the message....

But it sounds like the print statement after that if is indented the same amount as the if. It should be one stop further to the right.

Thanks, helped a lot :).