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 for off-topic chat!

Please prefer not to PM members. The point of the forum is so that anyone can benefit. We don't want to help you over PMs/emails/Skype chats that others can't benefit from :)
User avatar
Posts: 2906
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to General Coding Help

Who is online

Users browsing this forum: Google [Bot] and 8 guests