how do we add a list to a list? - CORRECT ANSWER list[2] = [1, 2, 3]
how do we ad elements of a list to a list? - CORRECT ANSWER list[2:2] = [1,2,3]
how do we delete elements from a list? - CORRECT ANSWER del list[1]
what's another way of deleting elements from a list, besides del? - CORRECT ANSWER list[1] = []
what does 3 * [0] return? - CORRECT ANSWER [0,0,0]
if you really want to copy a list, what can you do? - CORRECT ANSWER list2 = list1[:]
difference between append and extend? - CORRECT ANSWER append adds whole argument as single
element, while extend adds each item of argument as element
how to insert exactly one element? - CORRECT ANSWER list.insert(position, element)
what does remove do to a list? - CORRECT ANSWER removes first element in list with given value
what does list.sort() do? - CORRECT ANSWER
what does list.index() do? - CORRECT ANSWER
what does list.count() do? - CORRECT ANSWER
what does dict.get(key) return if the key exists? - CORRECT ANSWER the value of the key
, what does dict.get(key) return if the key does not exist? - CORRECT ANSWER None
what kind of objects do dictionary methods return? - CORRECT ANSWER view
what are the three dictionary methods? - CORRECT ANSWER keys(), values(), items()
what is the advantage of returning dictionary methods as view objects rather than as lists? - CORRECT
ANSWER thye are dynamic and reflect changes to the dictionary
define list - CORRECT ANSWER collection of different objects indexed by numbers
what is the big difference between strings and lists? - CORRECT ANSWER strings are immutable, lists are
mutable
what is the difference between list[2] = [1,2,3] and list[2:2] = [1,2,3]? - CORRECT ANSWER [2] adds as
list, [2:2] adds as separate elements
how many elements does list[2:3] represent? - CORRECT ANSWER one
where does a slice end? - CORRECT ANSWER right before the second index of the slice
how do you remove element three from a list by slicing? - CORRECT ANSWER list[2:3] = []
is len a function or a method? - CORRECT ANSWER function
how to find the length of a list? - CORRECT ANSWER len(list)
what do we have to know about the operands of list operators? - CORRECT ANSWER both must be lists