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

I am using the workspace for testing but can't call python script

I entered "python test.py" in the console, but got SyntaxError all the time. I saved the file already.

4 Answers

Can you share your code? There might be a mistake in your code

I get syntax errors constantly too, and I recreated the commands verbatim from the tutorial. Please check my code, thanks!

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

if name == "Rich": print(name + " is a lumberjack and he's OK!") else: print(name + " sleeps all night and " + name + " works all day!")

I just checked and it runs fine for me. Remember though that your indentations are important in Python. Refer the code below. I would advise you to check your indents

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

if name == "Rich":
    print(name + " is a lumberjack and he's OK!")
else:
    print(name + " sleeps all night and " + name + " works all day!")

Figured it out, I had to quit() to run the program, thanks!