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 Python Basics (Retired) Ins & Outs String Concatenation

James Shackelford
James Shackelford
501 Points

Error 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?

Gunhoo Yoon
Gunhoo Yoon
5,027 Points

You need to tell us what the error message says and what you were trying to do more specifically. Putting up the code is better.

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

The 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