What does a function do?

Nils O. Selåsdal noselasd at frisurf.no
Tue Apr 24 05:51:39 EDT 2001


"alki" <webmaster at pawntastic.com> wrote in message
news:dW2F6.3685$5t3.283453 at newsread1.prod.itd.earthlink.net...
> What does a function do? I read a book, but I have no idea what the
purpose
> of a function is.
def square(number):      #define a function named square and takes one inpt
parameter,
    return number*number; #this is the (simple) body of the function, it
uses the parameters given to it and return a result...

The square function takes  one imput parameter and return its square..
call it like
a=square(4)
a now contains 4 .
I suggest that you take a look at the tutorials and some simple examples at
www.python.org






More information about the Python-list mailing list