Slide 9
Slide 9 text
Deeper features: iteration and mapping
xs = [1, 2, 3, 4, 5]
# Produce generator for list [2, 3, 4, 5, 6]
ys = map(lambda x: x + 1, xs)
# Produce generator for list [2, 3, 4, 5, 6]
zs = [x+1 for x in xs]
# Iterate over the collections with generalized for
for x, y, z in zip(xs, ys, zs):
print(x, y, z)