pimento[~]$ fixscreenmirror pimento[~]$ python3 Python 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> s = "swarthmore" >>> len(s) 10 >>> num_chars = len(s) >>> num_chars 10 >>> empty = "" >>> len(empty) 0 >>> s + s 'swarthmoreswarthmore' >>> c = "college" >>> s + " " + c 'swarthmore college' >>> s + " " + c 'swarthmore college' >>> s + " " + c # concatenation 'swarthmore college' >>> >>> s*4\ ... 'swarthmoreswarthmoreswarthmoreswarthmore' >>> s*4 'swarthmoreswarthmoreswarthmoreswarthmore' >>> exit() pimento[~]$ update21 No new updates found. Last two updates shown below 39 minutes ago Wed Sep 12 10:00:02 2018 -0400 inclass/w02/blastoff.py inclass/w02/indexing.py inclass/w02/square.py practice/reverse.py 22 hours ago Tue Sep 11 13:02:15 2018 -0400 practice/madlib.py practice/repeat_word.py pimento[~]$ cd cs21/inclass/w02/ pimento[w02]$ atom xo.py pimento[w02]$ python3 ~/Documents/xo_sol.py Enter a positive integer: 10 xxxxxxxxxxxxxxxxxxxx oooooooooooooooooooo xoxoxoxoxoxoxoxoxoxo pimento[w02]$ python3 xo.py Enter an integer: 3 xxxxxx pimento[w02]$ python3 xo.py Enter an integer: 3 xxxxxx oooooo xoxoxo pimento[w02]$ python3 xo.py Enter an integer: 10 xxxxxxxxxxxxxxxxxxxx oooooooooooooooooooo xoxoxoxoxoxoxoxoxoxo pimento[w02]$ python3 ~/Documents/pretty_print.py Enter name: Robert ---------- | Robert | ---------- pimento[w02]$ python3 ~/Documents/pretty_print.py Enter name: Juan -------- | Juan | -------- pimento[w02]$ python3 ~/Documents/pretty_print.py Enter name: Eva ------- | Eva | ------- pimento[w02]$ python3 ~/Documents/pretty_print_sec2.py 34 ---------- | Yasmin | ---------- ------- | Eva | ------- -------- | Abby | -------- ------------ | Angelina | ------------ --------- | Chris | --------- -------- | Josh | -------- --------- | Ricky | --------- ------------ | Chrisbet | ------------ --------- | Colin | --------- -------- | Gwen | -------- ---------- | Julian | ---------- -------- | Luke | -------- -------- | Dean | -------- ---------- | Rachel | ---------- ------- | Kat | ------- -------- | Matt | -------- -------- | Eudy | -------- -------- | Juan | -------- --------- | Karin | --------- ------------ | Juliette | ------------ ----------- | Karinna | ----------- --------- | Ghazi | --------- ---------- | Jordan | ---------- ------- | Sam | ------- -------- | Ella | -------- ----------- | Mirabai | ----------- --------- | Bilal | --------- ------------- | Christina | ------------- -------- | Iris | -------- ----------- | Tiffany | ----------- ------- | Tom | ------- -------- | Owen | -------- ---------- | Larkin | ---------- ---------- | Robert | ---------- pimento[w02]$ python3 Python 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> s = "swarthmore" >>> s[4] 't' >>> s[0] 's' >>> num_chars = len(s) >>> s[num_chars] Traceback (most recent call last): File "", line 1, in IndexError: string index out of range >>> s[num_chars-1] 'e' >>> range(34) range(0, 34) >>> list(range(34)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33] >>> classes = [3,2,4,2,1] >>> len(classes) 5 >>> classes[0] 3 >>> classes[4] 1 >>> my_range = range(10) >>> my_range[4] 4 >>> list(my_range) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> my_range[8] 8 >>> for i in range(10): ... print(i) ... 0 1 2 3 4 5 6 7 8 9 >>> my_str = "rain" >>> num_chars = len(my_str) >>> num_chars 4 >>> for i in range(num_chars): ... print(my_str[i]) ... r a i n >>> for i in range(num_chars): ... print(i, my_str[i]) ... 0 r 1 a 2 i 3 n >>> for index in range(num_chars): ... print(index, my_str[index]) ... 0 r 1 a 2 i 3 n >>> exit() pimento[w02]$ python3 ~/Documents/square_sol.py Enter an integer: 5 ***** ***** ***** ***** ***** pimento[w02]$ python3 ~/Documents/square_sol.py Enter an integer: 10 ********** ********** ********** ********** ********** ********** ********** ********** ********** ********** pimento[w02]$ python3 ~/Documents/blastoff_sol.py Enter an integer: 5 5 4 3 2 1 blastoff! pimento[w02]$ python3 ~/Documents/blastoff_sol.py Enter an integer: 10 10 9 8 7 6 5 4 3 2 1 blastoff! pimento[w02]$