Python 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) [MSC v.1944 64 bit (AMD64)] on win32 Enter "help" below or click "Help" above for more information. l = [1,2,3,4,5] [1] [1] l[1] 2 l[2:] [3, 4, 5] l[2:4] [3, 4] l[2:5] [3, 4, 5] l = [10,20,30,40,50] l [10, 20, 30, 40, 50] l[1] 20 l[2:5] [30, 40, 50] l[1:5:2] [20, 40] l[2:] [30, 40, 50] l[2:len(l)] [30, 40, 50] l[:3] [10, 20, 30] l[::-1] [50, 40, 30, 20, 10] [DEBUG ON] =================== RESTART: C:\CS1_F25\website\demo\t1q16.py ================== =================== RESTART: C:\CS1_F25\website\demo\t1q16.py ================== 1 3 [DEBUG ON] s = "a line\nanother line." [DEBUG OFF] s Traceback (most recent call last): File "", line 1, in s NameError: name 's' is not defined s = "a line\nanother line." s 'a line\nanother line.' print(s) a line another line. s2 = """ a line another line yet another""" print(s2) a line another line yet another s3 = "a line SyntaxError: unterminated string literal (detected at line 1) p = 123 p 123 12 == 24 False 12 == 12 True q = 12 q 12 q == 12 True if q == 12: print("yes") yes range('a','z') Traceback (most recent call last): File "", line 1, in range('a','z') TypeError: 'str' object cannot be interpreted as an integer ord('a') 97 ord('b') 98 >>> ord('c') 99 >>> letter = 'a' >>> letter = chr(ord(letter) + 1) >>> letter 'b' >>> letter = chr(ord(letter) + 1) >>> letter 'c' >>> [10,20,30,40,50][2:4] [30, 40] >>> a = 12 >>> a 12 >>> a == 12 True >>> True == True True >>> True == False False >>> a = 1 >>> b = 2 >>> a > b False >>> a > b and True False >>> a > b and False False >>> a > b or True True >>> a > b or not True False