[Tutor] (no subject)

Alan Gauld alan.gauld at freenet.co.uk
Thu Aug 17 23:50:34 CEST 2006


> thank you Mr. Johnson this is my first program so its a little 
> sloppy. I'm
> using gedit ill check out the other editors that u have thank you

If you have Python you will have either IDLE or Pythonwin (or both)
Both of these will allow block indent/unindent so simply load the
code into IDLE to do the indentation.. You can go back to gedit
afterwards if you like.

But as Kent said you should ideally aimto write the code as
functions, each about 5-50 lines long (less than 5 and the advantage
is minimal, mor than 50 is just too long - around 12 lines per 
functoion
is a good average IMHO

But don't use number of lines as the deciding factor! Divide the code
into blocks of code that do something logical that you can describe
in a few words (see the comments from Danny to Kermit for examples!)
Use those few words to name the function. Consider how to pass key
data between the funbctions using parameters and return values.

If you don't know how to write functions take a look at the Functions
topic of my tutor.

HTH,

Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list