Message from discussion
ten small Python programs
Path: g2news1.google.com!news3.google.com!news.germany.com!feeder.news-service.com!newsgate.cistron.nl!xs4all!transit2.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path: <showel...@yahoo.com>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@bag.python.org
X-Spam-Status: OK 0.021
X-YMail-OSG: EoGkFGgVM1mgRJO6ZcToP9FJLbgnM0t.jyKln1kbCrJW3YKe4Vb1MMVORsSCIxe5UH57mu9fhoaB9oXU7S.MxNB0sJdtnuUjzHMuWCOzuqk9Cuqm48.Oi8WvxFFznA--
Date: Sun, 27 May 2007 08:23:26 -0700 (PDT)
From: Steve Howell <showel...@yahoo.com>
Subject: Re: ten small Python programs
To: BartlebyScrivener <bscrivene...@gmail.com>,
python-l...@python.org
In-Reply-To: <1180269944.944150.135930@q66g2000hsg.googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-BeenThere: python-l...@python.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list>
List-Post: <mailto:python-l...@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-requ...@python.org?subject=subscribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.8254.1180279412.32031.python-list@python.org>
Lines: 38
NNTP-Posting-Host: 194.109.207.14
X-Trace: 1180279412 news.xs4all.nl 328 [::ffff:194.109.207.14]:34048
X-Complaints-To: abuse@xs4all.nl
--- 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