What does a function do?

D-Man dsh8290 at rit.edu
Mon Apr 23 19:49:18 EDT 2001


On Mon, Apr 23, 2001 at 11:30:17PM +0000, alki wrote:
| What does a function do? I read a book, but I have no idea what the purpose
| of a function is.

It does what you define it to do.  It's purpose is to let you group
together a sequence of statements, then use that group of statements
(function) in many parts of your program.  If you later realize that
there was an error in the function, you only have to change code in 1
place to fix it.  If you simply wrote out the function body everywhere
you wanted to use it, you would have to find all those places and make
the fix many times.

HTH,
-D





More information about the Python-list mailing list