Snake Wrangling for Kids - Learning to Program with Python 2, linux-v0.7.2 (2007).pdf

(1253 KB) Pobierz
Snake Wrangling for Kids - Learning to Program with Python
519329133.001.png
Snake Wrangling for Kids, Learning to Program with Python
by Jason R. Briggs
Version 0.7.2
Copyright c 2007.
Published by... ah, no one actually.
Cover art and illustrations by Nuthapitol C.
Thanks To:
Guido van Rossum (for benevelont dictatorship of the Python language), the mem-
bers of the Edu-Sig mailing list (for helpful advice and commentary), and author
David Brin (the original instigator of this book).
License:
This work is licensed under the Creative Commons Attribution-Noncommercial-
Share Alike 3.0 New Zealand License. To view a copy of this license, visit
Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
Below is a summary of the license.
You are free:
•to Share to copy, distribute and transmit the work
•to Remix to adapt the work
Under the following conditions:
Attribution. You must attribute the work in the manner specified by the author
or licensor (but not in any way that suggests that they endorse you or your
use of the work).
Noncommercial. You may not use this work for commercial purposes.
Share Alike. If you alter, transform, or build upon this work, you may distribute
the resulting work only under the same or similar license to this one.
For any reuse or distribution, you must make clear to others the license terms of
this work.
Any of the above conditions can be waived if you get permission from the copyright
holder.
Nothing in this license impairs or restricts the author’s moral rights.
Contents
iii
1.1 A Few Words About Language . . . . . . . . . . . . . . . . . . . . . 3
1.3 Your first Python program . . . . . . . . . . . . . . . . . . . . . . . . 4
9
2.1 Use of brackets and “Order of Operations” . . . . . . . . . . . . . . . 11
2.2 There’s nothing so fickle as a variable . . . . . . . . . . . . . . . . . . 13
2.3 Using Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.4 A Piece of String? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.5 Tricks with Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.6 Not quite a shopping list . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.7 Tuples and Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
2.8 Things to try . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.1 Things to try . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
33
4.1 Do this. . . or ELSE!!! . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
i
Zgłoś jeśli naruszono regulamin