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 trialdiegoholt
1,076 PointsIndentation
So I'm curious about the indentation. Is it required for the code to compile properly? Or is it purely for visual effect?
I.e if we have
def function():
print("hello)
would that be identical to
def function():
print("hello)
2 Answers
Shane Robinson
7,324 PointsShort answer: white space matters, in Python.
The why, would take a bit more explanation and I am feeling lazy so read here: "What is Python Whitespace and how does it work?"
alan ingram
Courses Plus Student 3,979 PointsNo the two are not the same. If you use IDLE it will indent your second line for you so you wont even be able to input it incorrectly.
diegoholt
1,076 Pointsdiegoholt
1,076 PointsThat's what Kenneth seemed to be implying. Thanks for the clarification and link. Cheers