python idle

This is the place for queries that don't fit in any of the other categories.

python idle

Postby avm31982 » Wed Dec 11, 2013 1:28 am

yeah I just installed python 3.3 from, i'm following along with a book to learn how to code with python and it says of course

Code: Select all
print "Hello, world!"

just like that. So I typed it, just like that and this is what I get:

Code: Select all
>>>print "Hello, world!"
   File "<stdin>", line 1
      print "Hello, world!"
SyntaxError: invalid syntax

was wondering why I'd get that message.
Last edited by micseydel on Wed Dec 11, 2013 1:31 am, edited 1 time in total.
Reason: Locked OP.
Posts: 1
Joined: Wed Dec 11, 2013 1:24 am

Re: python idle

Postby micseydel » Wed Dec 11, 2013 1:35 am

Your book is for Python 2. In Python 3, print is no longer a statement and instead is a function. So it needs parenthesis.

You should either install Python 2 or buy a book for Python 3. Python 3 is newer, but Python 2 is more supported, and it's ok to stick with it for now. You can read here for more about the trade offs.
Join the #python-forum IRC channel on!

Please do not PM members regarding questions which are meant to be discussed publicly. The point of the forum is so that others can benefit from it. We don't want to help you over PMs or emails.
User avatar
Posts: 1992
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: metulburr and 2 guests