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' >>>