[Tutor] Print question in IDLE

Alan Gauld alan.gauld at btinternet.com
Sat Jan 31 02:05:50 CET 2009


"jims" <jandmstull at gmail.com> wrote

>I apologize for asking such a dumb question

The only dumb questions are the ones you don;t ask.
Its how to learn!

> Simply put here is where I am stuck. (Python version 3.0)
>
> I type in the example using the comment command:
>
> (example)  *>>> "food is very nice" #lets eat


The >>> prompt is produced by Python so you don;t type it.

ie you need to be in the intreractive shell window
of IDLE for this to work.

> (*What I do get is) SyntaxError:  invalid syntax (<pyshell#3>,  line 
> 1)

If you are typing the >>> then thats what you will get. You don't
type the >>>

BTW YOu are using Python 3 - that has some inconsistencies
with older versions which might catch you out. The biggest is
probably that where older tutorials (including mine currently)
will show

>>> print "foo"

In Python 3 you need to use

>>> print ("foo")

ie use parens around the stuff to be printed. There are a few
other changes to print as well so if you do find wierd things
happening ask here for advice.

I am currently updating my tutorial to v3 but it will be a slow
process. The v3 version will be on the URL below...

HTH,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l2p/ 




More information about the Tutor mailing list