Example of Function

Volucris volucris at hotmail.com
Tue Apr 24 00:50:22 EDT 2001


I'm making this beautiful code public domain. Feel free to distribute it as
you see fit.
<wink>
"Volucris" <volucris at hotmail.com> wrote in message
news:3ae5008b$0$769$6e49188b at news.goldengate.net...
>
> >>> 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