- Making lists with stuff in them
- access just like strings!
- O-indexed
- assignment with
list[index]
syntax, touch on mutability ("this can be changed, strings can't")
- also just like strings!
- Assume class has seen
for
/while
before, provide examples with lists
+
in
.append()
.pop()
.sort()
- Making dicts with stuff in them
- Talk about how they aren't ordered
- access looks like lists and strings!, but is a little bit different.
- assignment is kind of like with lists, but you can add whole items!
- example of iteration over keys
- introduce
.keys()
and.values()
by way of iteration examples
in
- Accessing items out of bounds: What happens? How can we decide whether to try accessing a certain index?
len
to the rescue!
- Accessing items that aren't present: What happens? How can we decide whether to try accessing a certain index?
.get()
andin
to the rescue!
It's useful but... a large number of python programmers seem to go years without learning about
enumerate