Python 3.5.2+ (default, Sep 22 2016, 12:18:14) [GCC 6.2.0 20160927] on linux Type "copyright", "credits" or "license()" for more information. >>> [1,2,3] [1, 2, 3] >>> ['CAT', 'DOG', 'MOUSE'] ['CAT', 'DOG', 'MOUSE'] >>> [[2,3], [4,5,8]] [[2, 3], [4, 5, 8]] >>> ['CAT', 3, True] # NEVER DO THIS ['CAT', 3, True] >>> type([1,2,3]) >>> '' '' >>> "" '' >>> '' + 'hello' 'hello' >>> [] # empty list [] >>> animals = ['horse', 'chimpanzee', 'tiger', 'manatee'] >>> animals[0] 'horse' >>> animals[0][2] 'r' >>> animals[1:3] ['chimpanzee', 'tiger'] >>> animals + animals ['horse', 'chimpanzee', 'tiger', 'manatee', 'horse', 'chimpanzee', 'tiger', 'manatee'] >>> 'horse' * 3 'horsehorsehorse' >>> animals * 3 ['horse', 'chimpanzee', 'tiger', 'manatee', 'horse', 'chimpanzee', 'tiger', 'manatee', 'horse', 'chimpanzee', 'tiger', 'manatee'] >>> len(animals) 4 >>> len(animals[1]) 10 >>> animals ['horse', 'chimpanzee', 'tiger', 'manatee'] >>> animals[1] = 'cow' >>> animals ['horse', 'cow', 'tiger', 'manatee'] >>> s = 'horse' >>> s[2] = 'u' Traceback (most recent call last): File "", line 1, in s[2] = 'u' TypeError: 'str' object does not support item assignment >>> animals ['horse', 'cow', 'tiger', 'manatee'] >>> animals[4] = 'pig' Traceback (most recent call last): File "", line 1, in animals[4] = 'pig' IndexError: list assignment index out of range >>> animals.append('pig') >>> animals ['horse', 'cow', 'tiger', 'manatee', 'pig'] >>> ========== RESTART: /home/brent/teaching/150/lectures/S17/lists.py ========== >>> animals Traceback (most recent call last): File "", line 1, in animals NameError: name 'animals' is not defined >>> ========== RESTART: /home/brent/teaching/150/lectures/S17/lists.py ========== >>> explode_list(animals) gorilla dog koala python >>> ========== RESTART: /home/brent/teaching/150/lectures/S17/lists.py ========== >>> explode_list(animals) gorilla dog koala python >>> ========== RESTART: /home/brent/teaching/150/lectures/S17/lists.py ========== >>> read_inputs >>> read_inputs() What would you like to list? manatee What would you like to list? sea cow What would you like to list? HArambe What would you like to list? bacon What would you like to list? quit ['manatee', 'sea cow', 'HArambe', 'bacon'] >>> ========== RESTART: /home/brent/teaching/150/lectures/S17/lists.py ========== >>> read_inputs2() What would you like to list? cats What would you like to list? quit ['cats', 'quit'] >>>