print "Hello, World!"
If you are using the command line to run programs then type it in with a text editor, save it as hello.py and run it with ``python hello.py''
Otherwise go into PythonWin or IDLE, create a new window, and create it as in section 1.4.
When this program is run here's what it prints:
Hello, World!
Now I'm not going to tell you this every time, but when I show you a program I recommend that you to type it in and run it. I learn better when I type it in and you probably do too.
Now here is a more complicated program:
print "Jack and Jill went up a hill" print "to fetch a pail of water;" print "Jack fell down, and broke his crown," print "and Jill came tumbling after."
When you run this program it prints out:
Jack and Jill went up a hill to fetch a pail of water; Jack fell down, and broke his crown, and Jill came tumbling after.
When the computer runs this program it first sees the line:
print "Jack and Jill went up a hill"
Jack and Jill went up a hill
Then the computer goes down to the next line and sees:
print "to fetch a pail of water;"
So the computer prints to the screen:
to fetch a pail of water;
The computer keeps looking at each line, follows the command and then goes on to the next line. The computer keeps running commands until it reaches the end of the program.