Example of Function

Volucris volucris at hotmail.com
Tue Apr 24 00:27:55 EDT 2001


>>> def welcome():
...  #a funtion with no return value (a procedure)
...  print '***********'
...  print 'Hello World'
...  print '***********'
...
>>> welcome()
***********
Hello World
***********
>>> def double(num):
...  #a function in the traditional sense (has a return value)
...  new_num = num * 2
...  return new_num
...
>>> my_num = double(6)
>>> print my_num
12

"alki" <webmaster at pawntastic.com> wrote in message
news:DV5F6.4485$5t3.336201 at newsread1.prod.itd.earthlink.net...
> Will someone please give me how a function is written and how it's used?
> Thx.
>
>





More information about the Python-list mailing list