# [Tutor] More Function Questions (Joseph Q.)

Lee Cullens leec03273 at mac.com
Sun Apr 17 19:17:11 CEST 2005

I think your looking at it too literally Joseph.  Rather than any one
example, think of a function as a block of code that is used in more
than one place in your program.  The x + y block of code is just a
simplistic representation, intended to illustrate without the
distracting complications of a more involved algorithm.

Functions are also useful (even necessary) in various approaches to
problem solving.  If you need an example one might be the recursive
matrix solution approach I posted a link to in another post to this
list.

Lee C

On Apr 17, 2005, at 12:29 PM, Joseph Quigley wrote:

> Hi all,
> Another function question.....
>
> def bar(x, y):
> 	return x + y
>
> bar(4, 5)
>
> So I can put anything I want in there. What good is a function like
> that?
> Of course I know about.
> def foo():
> 	print "Hello all you who subscribe to the Python Tutor mailing list!"
>
> So what do you use the
> def bar(x, y):
> 	return x + y
>
> bar(4, 5)
>
> functions for? (I just need a simple example)
> Thanks,
> 	Joe
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>