Syntax error in Hello World

356 views
Skip to first unread message

tim.sho...@gmail.com

unread,
Feb 6, 2013, 2:11:10 PM2/6/13
to python-g...@googlegroups.com
I have just started, just installed python following the google tutorial. When I run the hello world program I get

    File "hello.py", line 29
        print 'Hello', name

SyntaxError: invalid syntax


What am I doing wrong?

Sergio Andrés Figueroa Santos

unread,
Feb 7, 2013, 12:06:19 PM2/7/13
to python-g...@googlegroups.com
The problem may be about indentation on this or the previous line. Please, send the full code to get a better analysis.

Alok K Shukla

unread,
Feb 7, 2013, 12:15:49 PM2/7/13
to python-g...@googlegroups.com
This has supposedly something to do with your python version, the tutorial is for Python 2.5 or 2.7 I guess and you're using Python 3.3 probably. If that is the case, following would work
>name="Tim"
>print ("Hello "+ name)
Hello Tim



--
You received this message because you are subscribed to the Google Groups "Python GCU Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-gcu-for...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
aks

Akkul Sahariya

unread,
Feb 10, 2013, 4:53:27 AM2/10/13
to python-g...@googlegroups.com
okay This worked on my console
 
In [21]: name='Tim'


In [22]: name

Out[22]: 'Tim'


In [23]: print 'Hello '+name

Hello Tim

Sergio Andrés Figueroa Santos

unread,
Feb 10, 2013, 10:44:13 AM2/10/13
to python-g...@googlegroups.com
Then triple check the indentation on the file, because it's the most likely explanation.

Sergio A. Figueroa


--

Devabhaktuni Akhila Devi

unread,
Jun 11, 2017, 10:22:22 AM6/11/17
to Python GCU Forum
I'm facing the same problem. Did you resolve your code! If so, what changes did you make..

Kushashwa Ravi Shrimali

unread,
Jun 19, 2017, 9:34:17 AM6/19/17
to Python GCU Forum
Please attach the screenshot of the error. It will help to understand the exact problem. 
Also if possible, let us know the variable declaration you have used. 
Reply all
Reply to author
Forward
0 new messages