[Tutor] Hello World.

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Sat, 16 Mar 2002 14:22:00 -0800 (PST)


On Sun, 17 Mar 2002, Spam wrote:

> Er, I know to type 'print'... But I was just intrigued, first by the
> website (which may be old, or merely inaccurate), but more by the fact
> I couldn't see why the Python Shell would be different.

Python is designed to act slightly differently to make it more useful as
an interactive environment.  In interactive mode, values that would have
otherwise just fallen on the floor will get picked up and printed on
screen so we can see those values.  For example, in the interpreter:

###
>>> for x in range(10):
...     x
... 
###

actually prints numbers out, but that's just because Python expects that
we'd like to see those values.  In a preprepared program, though, Python
won't do this unless we explicitely say "print x".


Hope this helps!