Python Reading
- Read the chapter entitled Lists
from section "Repetitions and References" through section "List Comprehensions". (You may skip the section entitled "The Return of L-Systems".)
Key Ideas
- List Methods
- append(item)
- insert(position, item)
- pop() or pop(position)
- sort()
- reverse()
- index(item)
- count(item)
- remove(item)
- List Append vs. List Concatenation
- for loop list traversal
- A function parameter can be a list
- A pure function does not modify its parameters.
In general, modifying a parameter can produce an undesirable
side effect and should be avoided.
- A function can return a list
- List Comprehensions (this is a shortcut and is optional to understand)
- [<expression> for <item> in <sequence>]
- [<expression> for <item> in <sequence> if <condition>]
Active Learning
Work the following exercises:
- Exercise 19
- Exercise 21
- Exercise 23
- Exercise 26: a, c, e