# Pause for Breath --- CS 65 // 2021-03-23 ## Administrivia - Exam 2 is due tonight - Rearranged the schedule a bit to complete the lists lab today - No assignment due Thursday ## Extra Credit Activities - [Test Anxiety: Breath](https://calendar.drake.edu/event/test_anxiety_breath?utm_source=newsletter&utm_medium=email&utm_content=DETAILS&utm_campaign=Faculty-March-23#.YFoEI0hKhLw) + Thursday, 3/25 from 2pm to 3pm ## Extra Credit Activities - [BLM Event](https://www.eventbrite.com/e/blmdrake-tickets-147650180665) + Two Drake alums are speaking on racial justice and equity with a Q&A to follow + Friday, 3/26 from noon to 1pm # Questions ## ...about anything? # Lists ## The `list` Type - **Purpose:** + To manipulate collections of objects - **Express:** + Lists are written: `[1,2,3]` and `["CS", 65]` - **Operations:** + `t[index]`, gets the object at the given `index` + `t[start:end]`, gets the **sublist** that starts at index `start` and ends at index `end` + `t1 + t2`, concatenates the two lists together ## The `list` Type - **Other Operations**: + `len(t)`, gets the **length** of the list `t` + `t.append(value)`: mutates `t` by adding `value` as a new element to the end of the list + `t.sort()`: mutates `t` so that all of its elements are in ascending order + `t.pop(index)`: mutates `t` by removing the element at the given `index` ## Mutability - `list` is a **mutable** type + It is possible to change the values a list contains **without creating a new list** + `lst = [100, 101, 102]` + `lst[0] = "abc"`, changes the first element - Other methods like `append`, `sort`, and `pop` also mutate the list rather than returning a new one # Lab Time - Navigate to and work through the **Lists** lab