Message from discussion
ten small Python programs
Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!213.132.189.2.MISMATCH!multikabel.net!feed20.multikabel.net!newshub2.home.nl!newshub3.home.nl!home.nl!feeder1.cambrium.nl!feed.tweaknews.nl!62.216.30.27.MISMATCH!newsgate.cistron.nl!xs4all!transit3.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path: <johnmast...@oxtedonline.net>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@bag.python.org
X-Spam-Status: OK 0.039
Date: Sat, 26 May 2007 20:15:16 +0100
From: John K Masters <johnmast...@oxtedonline.net>
To: python-l...@python.org
Subject: Re: ten small Python programs
Mail-Followup-To: python-l...@python.org
References: <162044.45569.qm@web33507.mail.mud.yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <162044.45569.qm@web33507.mail.mud.yahoo.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
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.8218.1180206925.32031.python-list@python.org>
Lines: 33
NNTP-Posting-Host: 194.109.207.14
X-Trace: 1180206925 news.xs4all.nl 324 [::ffff:194.109.207.14]:46549
X-Complaints-To: abuse@xs4all.nl
On 11:43 Sat 26 May , Steve Howell wrote:
> I've always thought that the best way to introduce new
> programmers to Python is to show them small code
> examples.
>
> When you go to the tutorial, though, you have to wade
> through quite a bit of English before seeing any
> Python examples.
>
> Below is my attempt at generating ten fairly simple,
> representative Python programs that expose new users
> to most basic concepts, as well as the overall syntax.
>
> It was an interesting exercise. I constrained myself
> to ten lines or less, and it was pretty easy to
> incorporate loops, conditionals, print, open(), lists,
> tuples, dictionaries, and imported modules.
>
> It was harder to show classes, and my ShoppingCart
> class is nothing more than an encapsulation of a list,
> which has dubious value (although it's the start of
> something more useful).
>
> Anyway, here goes:
>
Many thanks for that. This is exactly what is missing in most introductory
books. Simple, relevant and concise examples.
Regards, John
--
War is God's way of teaching Americans geography
Ambrose Bierce (1842 - 1914)