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 trialJames Shackelford
501 PointsError message
I am having a problem completing this task. I get Syntax Error message for else. I input it like the program shows. I even tried it in my 3.5 python program and keep getting the same result. What could be wrong and is there another commend that can be used instead?
1 Answer
Chris Freeman
Treehouse Moderator 68,457 PointsThe else
must be part of an if
statement. Make sure the else
is indented the same amount as the if
and that you include a colon after it. Finally there must be code following the else
(otherwise why would it be there) indented further still.
if condition1:
somecode
else:
othercode
Gunhoo Yoon
5,027 PointsGunhoo Yoon
5,027 PointsYou need to tell us what the error message says and what you were trying to do more specifically. Putting up the code is better.