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.

Tom Healey
1,755 PointsHow come this alternative code has an indentation error?
https://w.trhou.se/9owaya1qj3 I think it is because I have an if statement within a try statement, and an else statement(that is paired with the if statement) within another else statement(paired with try statement)
2 Answers

Pedro Cabral
33,584 PointsThere is no try in the code you shared. Did you share the correct file?

Jordan Krahn
6,726 PointsI'm pretty darn sure that you can't mix and match code blocks like that. If you start an if statement in a try block, you have to finish that if statement in the same try block. So any elses or elifs have to be in the same block.
It's the same the other way around. So you can't do
if
try
else
except
The try and except would have to be in the same if block.
Tom Healey
1,755 PointsTom Healey
1,755 PointsSorry about that here is the right one https://w.trhou.se/dfx4pypgvp and its on the masterticket.py file