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

Juliette Tworsey
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,425 Points

python lumberjack.py syntax error

name = input("What's your name? ")

if name == "Juliette": 

    print(name + " is a lumberjack and she's OK!") 

else: 
    print(name + " sleeps all night and " + name + " works all day!")

I am getting an invalid syntax error when attempting to run python lumberjack.py in the Workspaces console.

What could be wrong?

Thanks!

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,441 Points

The syntax of the code is correct. Can you post the syntax error message?

You have to run the exit() command and clear command before executing the lumberjack.py project.

exit()
clear()
python lumberjack.py

Hi Tomasz, I followed this and I got this error:

python lumberjack.py
bash: syntax error near unexpected token `python'

Any help? I am still stuck...