We have seen lists and a few list operations
+ - concatenating lists * - * [] - an index [:] - slicing in – membership within the list len - (the length operator) Let’s say we have two lists:
mylist = [4, 2, [5, 6, 37], 13, 13, 29]
yourlist = ["socks", "pillowcases", "tablecloth", 34.5]
What are the results of the following operations?
- len(mylist)
- max(mylist[2])
- min(mylist[2])
- mylist[2][2]
- sum(mylist[2])
- mylist[2]*3
- yourlist[-2:]
- yourlist[0]
- "socks" in yourlist
- yourlist*3
- yourlist < ["socks", "pillows"]