[Tutor] How to build a function?
Ole Jensen
learning.python at dbmail.dk
Thu Aug 19 21:20:53 CEST 2004
> Hi, I was reading a book about building a function but I just not
quite
> get it.
> Does anybody know where can I find more of this building function
> tutorial on the net?
> Or if anybody have time, could you kindly show me some example?
>
> Ivan
>
I like this short tutorial http://hetland.org/python/instant-hacking if
you browse down the page there is a section called "Bigger Programs -
Abstraction" that deals with defining functions. Below that it goes
further in to functions.
Basicly a function needs to be defined and then called e.g.:
>>> def square(x):
print x*x
>>> square(5)
25
>>> square(2.5)
6.25
>>> square(-3)
9
Regards Ole
More information about the Tutor
mailing list