[Tutor] A total newbie…sorry

Alan Gauld alan.gauld at btinternet.com
Fri Oct 28 09:38:17 CEST 2011

On 28/10/11 03:20, Joe Batt wrote:
> I am just starting to try to learn Python on IDLE on a Mac running

Welcome, and don't worry thee are no stupid questions.
And you've given us all the right info to answer too, well done! :-)

> Python 3.2.2 (v3.2.2:137e45f15c0b, Sep 3 2011, 17:28:59) and I have come
> unstuck at the very beginning I tried
>  >>> print "Hello"
> SyntaxError: invalid syntax

> the terminal using the same syntax it works
> Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
>  >>> print "Hello"
> Hello
> I can see its a different version but what is the problem?

Thats the problem. Python v3 has some big differences from v2.
And print is one of them. You need to put the string inside
parentheses: print ("hello"). But there are other subtle changes

You don't mention what tutorial you are using to learn
Python but it looks like it is based on v2 (as many are).
So either you should install IDLE for v2.7 and carry on
from there or find a tutorial for v3 and use that.

If you can already program in another language then the official 
tutorial on the python web site is a good choice as it gets updated with 
each release. If you are a complete beginner to programming you could 
try mine (see  below), but there are some others for v3 too.

Alan G
Author of the Learn to Program web site

More information about the Tutor mailing list