[Tutor] Noobish Syntay Error?

Dave Angel davea at ieee.org
Thu Aug 6 23:29:03 CEST 2009


Anna - Sophie Maeser wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">Hi!
> I want to ask you a quick question.. when I type in print '' hello 
> world'' and then press enter, it says there is a syntax error... I 
> really don't know what im doing wrong. I downloaded python 3.1 and am 
> using IDLE with it.. im using mac.
> Please help me findt he problem because its a very simple thing and I 
> dont know what I am doing wrong..
>
> -Anna
>
> </div>
>
Two syntax errors that I can see.

1) in python 3.1, print is a function, not a statement.  So you need 
parentheses around its argument.
2) You appear to be using two single quotes at each end of  your hello 
world string,     You want to either use a single-quote at each end, or 
a double-quote at each end.   This may just because you mistakenly used 
html to compose your email, instead of the preferred text mode.

Try:

print ("hello world")

If your tutorial material is describing Python 2.x, you may not want to 
be learning on Python 3.1, because there are a few of these gotchas.  It 
is possible to install both 2.6 and 3.1, and choose which one you use 
based on what you're working on.

DaveA



More information about the Tutor mailing list