ten small Python programs
John K Masters
johnmasters at oxtedonline.net
Sat May 26 15:15:16 EDT 2007
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)
More information about the Python-list
mailing list