Page 12 -
P. 12
table of contents
meet python
1 Everyone loves lists
You’re asking one question: “What makes Python different?”
The short answer is: lots of things. The longer answers starts by stating that there’s
lots that’s familiar, too. Python is a lot like any other general-purpose programming
language, with statements, expressions, operators, functions, modules, methods,
and classes. All the usual stuff, really. And then there’s the other stuff Python provides
that makes the programmer’s life—your life—that little bit easier. You’ll start your tour
of Python by learning about lists. But, before getting to that, there’s another important
question that needs answering…
What’s to like about Python? 2
Install Python 3 3
Use IDLE to help learn Python 4
Work effectively with IDLE 5
Deal with complex data 6
Create simple Python lists 7
Lists are like arrays 9
Add more data to your list 11
Work with your list data 15
For loops work with lists of any size 16
Store lists within lists 18
Check a list for a list 20
Complex data is hard to process 23
Handle many levels of nested lists 24
Don’t repeat code; create a function 28
Create a function in Python 29
Recursion to the rescue! 31
Your Python Toolbox 32
The Holy Grail, 1975, T erry Jones & T erry Gilliam, 91 mins
Graham Chapman
Michael Palin, John Cleese, T erry Gilliam, Eric Idle & T erry Jones
x