basil[~]$ fixscreenmirror basil[~]$ 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. >>> for i in range(3): ... print(i) ... 0 1 2 >>> for pickle in range(3): ... print(pickle) ... 0 1 2 >>> list(range(3)) [0, 1, 2] >>> cookies = ["chocolate", "sugar", "ginger"] >>> for cookie in cookies: ... print(cookies) ... ['chocolate', 'sugar', 'ginger'] ['chocolate', 'sugar', 'ginger'] ['chocolate', 'sugar', 'ginger'] >>> for cookie in cookies: ... print(cookie) ... chocolate sugar ginger >>> "oatmeal" in cookies False >>> "ginger" in cookies True >>> 7 in [6,7,10] True >>> 8 in [6,7,10] False >>> command = "Hit" >>> if command in ["Hit, "Stand"] File "", line 1 if command in ["Hit, "Stand"] ^ SyntaxError: invalid syntax >>> command in ["Hit, "Stand"] File "", line 1 command in ["Hit, "Stand"] ^ SyntaxError: invalid syntax >>> choices = ["Hit, "Stand"] File "", line 1 choices = ["Hit, "Stand"] ^ SyntaxError: invalid syntax >>> choices = ["Hit, "Stand"] File "", line 1 choices = ["Hit, "Stand"] ^ SyntaxError: invalid syntax >>> choices = ["Hit", "Stand"] >>> command in ["Hit", "Stand"] True >>> if command in ["Hit", "Stand"]: ... print("ok") ... ok >>> word = "greeting" >>> for i in range(len(word)): ... print(word[i]) ... g r e e t i n g >>> for ch in word: ... print(ch) ... g r e e t i n g >>> word 'greeting' >>> word[1] 'r' >>> word[1:4] 'ree' >>> word[1:] 'reeting' >>> word[:4] 'gree' >>> word[-1] 'g' >>> word[-2] 'n' >>> word[1:len(word)] 'reeting' >>> word[1:len(word)+1] 'reeting' >>> word[1:len(word)] 'reeting' >>> word[1:-1] 'reetin' >>> word[1:] 'reeting' >>> basil[~]$ vi transcript.labC.txt basil[~]$ basil[~]$ 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. >>> for i in range(3): ... print(i) ... 0 1 2 >>> list(range(3)) [0, 1, 2] >>> seqn = list(range(3)) >>> for i in seqn: ... print(i) ... 0 1 2 >>> for i in [3,6,7]: ... print(i) ... 3 6 7 >>> cookies = ["ginger", "chocolate", "sugar"] >>> cookies ['ginger', 'chocolate', 'sugar'] >>> for cookie in cookies: ... print(cookie) ... ginger chocolate sugar >>> word = "apple" >>> for i in range(len(word)): ... print(word[i]) ... a p p l e >>> for i in word: ... print(i) ... a p p l e >>> for ch in word: ... print(ch) ... a p p l e >>> "oatmeal" in cookies False >>> "ginger" in cookies True >>> command = "Hit" >>> command in ["Hit", "Stand"] True >>> "blah" in ["Hit", "Stand"] False >>> 7 in [8.9.2] File "", line 1 7 in [8.9.2] ^ SyntaxError: invalid syntax >>> 7 in [8,9,2] False >>> 2 in [8,9,2] True >>> word 'apple' >>> word[1] 'p' >>> word[1:3] 'pp' >>> word[1:] 'pple' >>> word[:3] 'app' >>> word[-1] 'e' >>> word[-2] 'l' >>> word[-3] 'p' >>>