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 trialAngela Anders
1,844 PointsI can not figure out why I am getting this Syntax error. Please help.
treehouse:~/workspace$ python
Python 3.6.4 (default, Apr 11 2019, 19:31:33)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
python hello.py
File "<stdin>", line 1
python hello.py
^
SyntaxError: invalid syntax
1 Answer
KRIS NIKOLAISEN
54,971 PointsAt the workspace prompt you can type python hello.py to run your program:
treehouse:~/workspace$ python hello.py
At the python prompt type import hello for the same results
>>> import hello
You also need to fix your code. There should be a quotation mark after ! instead of a parenthesis
print ("Have a great day {}!".format(first_name))
Angela Anders
1,844 PointsThanks for the help! I appreciate it. :)
Angela Anders
1,844 PointsAngela Anders
1,844 PointsThis is my code up top:
first_name = input("What is your first name? ")
print("Hello,", first_name) if first_name == "Angie" : print (first_name, "is learning Python") print ("Have a great day {}!).format(first_name))