ten small Python programs
Steve Howell
showell30 at yahoo.com
Sun May 27 11:23:26 EDT 2007
--- BartlebyScrivener <bscrivener42 at gmail.com> wrote:
> On May 26, 1:43 pm, Steve Howell
> <showel... at yahoo.com> wrote:
> > ------
> > # def defines a method in Python
> > def tax(itemCharge, taxRate = 0.05):
> > return itemCharge * taxRate
> > print '%.2f' % tax(11.35)
> > print '%.2f' % tax(40.00, 0.08)
> >
>
I decided to go with a simpler example up front.
------
# def defines a method in Python
def say_hello(name):
print 'hello', name
say_hello('Jack')
say_hello('Jill')
More here:
http://wiki.python.org/moin/SimplePrograms
Somebody also fixed a few style things in my other
examples, changing a tuple to a list, catching a more
specific exception. Whoever you are, thanks, I agree.
____________________________________________________________________________________Sick sense of humor? Visit Yahoo! TV's
Comedy with an Edge to see what's on, when.
http://tv.yahoo.com/collections/222
More information about the Python-list
mailing list