Go to Google Groups Home    comp.lang.python
Re: ten small Python programs

Steve Howell <showel...@yahoo.com>

--- BartlebyScrivener <bscrivene...@gmail.com> wrote:
> On May 26, 1:43 pm, Steve Howell
> <showel...@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