This is another exercise for you to do, with nothing to hand in. The goal of this exercise is to make sure you know how to create and run a simple Python program.
In an empty TextWrangler document, type one line:
print 'hello, world!'
Save your document with the file name hello.py. Make sure you keep track of the folder in which you have saved hello.py. You may wish to create a special folder for programming experiments.
Type the command:
python hello.py
(Don't forget to hit the Enter key after you have typed the command.) If everything has gone smoothly, you should see the "hello, world!" greeting. If you see an error message saying something like "hello.py: no such file or directory," you are probably not currently in the directory where hello.py is stored. Use "ls" and "cd" to help you move to the right directory.
While you're here, try running hello.py a different way, using the interactive Python interpreter. Type the command:
python
This should display some introductory text, followed bye a prompt that looks like this:
>>>
At this prompt, type:
import hello
This should cause your hello.py program to be loaded and executed, so you should see your "hello, world!" message again.
To exit from the interactive Python interpreter, type:
exit()