[Tutor] writing a program in Python

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed Dec 31 13:59:13 EST 2003



On Tue, 30 Dec 2003, Christopher Spears wrote:

> I guess this is a stupid question, but I am going to ask anyway...

Hi Christopher,

This is not a stupid question at all.  It's a very crucial one!


> How do you actually write a program in Python?  I know how to use IDLE
> to manipulate data, but how do I write several lines of code that goes
> out and does stuff.

I wrote a small tutorial that shows how to write a program in IDLE:

    http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html

The screen-captures are a little dated --- I need to fix my Windows box
someday... --- but should help show how to save and run Python programs.

The main idea is that we'll need to save our individual program
instructions in a separate 'program file'.  Think of a Word document,
except that instead of saving English text, we're saving Python source
code.

Once we save our program file to disk, then whenever we want to run that
program, we can tell Python to run across the whole program file.


Hope this helps!




More information about the Tutor mailing list