CS1110 Today: collections
Let’s grade all the students Repetition Groups of students String is one example of a group Contain several characters Today: various types that collect several things in one variable
Ordered Collection Type that has other things inside it Ordered: a first thing, second, third, … Sequence
Ordered Collections Type Stores Syntax Mutable? Range int range(3, 7) No Str character “” Tuple anything ( , , ) List [ , , ] Yes
Operations on Sequences Syntax Range? Str? Tuple? List? length len(s) Yes yes index s[1] slice s[1:3] concatenate s1 + s2 no multiply s*4 assignment s[1] = 5 No Yes (mutable)