pimento[~]$ fixscreenmirror pimento[~]$ cd cs21/ pimento[cs21]$ update21 No new updates found. Last two updates shown below 73 minutes ago Mon Oct 9 09:11:15 2017 -0400 inclass/week06/build_list.py inclass/week06/shuffle_list.py 3 days ago Fri Oct 6 17:57:37 2017 -0400 labs/05/QUESTIONS-05.txt labs/05/lineart.py labs/05/night.py pimento[cs21]$ cd inclass/week06/ pimento[week06]$ ls build_list.py shuffle_list.py pimento[week06]$ atom build_list.py pimento[week06]$ pimento[week06]$ pimento[week06]$ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> >>> lst1 = [5, 3, 7, 10, 12] >>> >>> lst1.append(15) >>> >>> lst1 [5, 3, 7, 10, 12, 15] >>> >>> lst1.append(7) >>> >>> >>> lst1 [5, 3, 7, 10, 12, 15, 7] >>> >>> lst1[0] 5 >>> lst1[0] = 10 >>> lst1 [10, 3, 7, 10, 12, 15, 7] >>> >>> s = "swarthmore" >>> s[0] 's' >>> s[0] = "S" Traceback (most recent call last): File "", line 1, in TypeError: 'str' object does not support item assignment >>> >>> lst1 [10, 3, 7, 10, 12, 15, 7] >>> >>> lst2 = lst1 >>> >>> lst2 [10, 3, 7, 10, 12, 15, 7] >>> >>> lst2[0] = 50 >>> lst2 [50, 3, 7, 10, 12, 15, 7] >>> >>> lst1 [50, 3, 7, 10, 12, 15, 7] >>> lst1[2] = -5 >>> >>> lst1 [50, 3, -5, 10, 12, 15, 7] >>> lst2 [50, 3, -5, 10, 12, 15, 7] >>> >>> >>> t = s >>> >>> s 'swarthmore' >>> t 'swarthmore' >>> >>> s +t 'swarthmoreswarthmore' >>> >>> lst1 [50, 3, -5, 10, 12, 15, 7] >>> >>> lst3 = [20,6] >>> >>> lst1 + lst3 [50, 3, -5, 10, 12, 15, 7, 20, 6] >>> lst4 = lst1 + lst3 >>> >>> lst1 [50, 3, -5, 10, 12, 15, 7] >>> lst3 [20, 6] >>> lst4 [50, 3, -5, 10, 12, 15, 7, 20, 6] >>> exit() pimento[week06]$ python3 build_list.py [1, 5, -4, 13, -3, 7, 11, -3, 7, 8] [1, 5, 0, 13, 0, 7, 11, 0, 7, 8] pimento[week06]$ python3 build_list.py enter a number: 5 enter a number: 3 enter a number: -2 enter a number: -9 enter a number: 10 [5, 3, -2, -9, 10] pimento[week06]$ pimento[week06]$ pimento[week06]$ pimento[week06]$ python3 build_list.py enter a number: 5 enter a number: 3 enter a number: -2 enter a number: -9 enter a number: 1- Traceback (most recent call last): File "build_list.py", line 43, in main() File "build_list.py", line 35, in main num = int(input("enter a number: ")) ValueError: invalid literal for int() with base 10: '1-' pimento[week06]$ pimento[week06]$ python3 build_list.py enter a number: 5 enter a number: 3 enter a number: -2 enter a number: -9 enter a number: 10 [5, 3, -2, -9, 10] [5, 3, 0, 0, 10] pimento[week06]$ atom shuffle_list.py pimento[week06]$ pimento[week06]$ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> >>> x = 4 >>> y = 7 >>> >>> # want to swap x and y ... >>> >>> x = y >>> y = x >>> >>> x 7 >>> y 7 >>> >>> x = 4 >>> y = 7 >>> >>> temp = x >>> temp 4 >>> >>> x = y >>> x 7 >>> y 7 >>> temp 4 >>> y = temp >>> >>> x 7 >>> y 4 >>> exit() pimento[week06]$