[Tutor] Brand new to python have simple problem

Kent Johnson kent37 at tds.net
Wed Jan 7 13:00:33 CET 2009


On Wed, Jan 7, 2009 at 1:06 AM, mickth <mickmick at hotmail.co.uk> wrote:
>
> I'm brand new to python and every time i start to learn it i get the same
> problem and end up giving up and moving on to another language.
>
> the print statement doesn't work in either the comand line or IDLE i get
> this in IDLE:
> SyntaxError: invalid syntax (<pyshell#0>, line 1)
>
> and just SyntaxError: invalid syntax in the command line.
>
> Even doing the hello world or doing simple sums. If I type "hello, world" i
> get the right outcome but print "Hello world" i get the error. When i type
> print it's purple in IDLE if that means anything.

What version of Python are you using? In Python 3.0, print is a
function, not a statement, so you need parentheses:
  print("Hello world")

Most Python books and tutorials are written for Python 2.x. Make sure
your references match the Python version you are using, there are
significant changes in 3.0.

Kent


More information about the Tutor mailing list