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. la = [10, 'a', 15] la [10, 'a', 15] id(la) 1874982497152 1874982497152l SyntaxError: invalid decimal literal lb = la lb [10, 'a', 15] id(lb) 1874982497152 la[0] = 99 la [99, 'a', 15] lb [99, 'a', 15] p = 6 id(p) 140719342646344 q = p id(q) 140719342646344 p 3 SyntaxError: invalid syntax p = 3 id(p) 140719342646248 q 6 id(la[0]) 140719342649320 la[0] 99 la[0] = 33 id(la[0]) 140719342647208 lc = [1,2,['a','b'],10] id(lc[0]) 140719342646184 lc[0] =55 id(lc[0]) 140719342647912 id(lc[2]) 1874982564928 lc[2].append('c') lc [55, 2, ['a', 'b', 'c'], 10] id(lc[2]) 1874982564928 la = [10, 'a', 15] la [10, 'a', 15] id(la) 1874982497152 1874982497152l SyntaxError: invalid decimal literal lb = la lb [10, 'a', 15] id(lb) 1874982497152 la[0] = 99 la [99, 'a', 15] lb [99, 'a', 15] p = 6 SyntaxError: multiple statements found while compiling a single statement lp = [1,2,3] lp [1, 2, 3] [item *10 for item in lp] [10, 20, 30] [str(item) for item in lp] ['1', '2', '3'] [str(item)*3 for item in lp] ['111', '222', '333'] [str(item)*3 for item in lp if item > 1] ['222', '333'] result = [] for item in lp: result.append(item * 10) result [10, 20, 30] result2 = [item * 10 for item in lp] result2 [10, 20, 30] for item in lp: print(item) 1 2 3 for i, item in enumerate(lp): print(f"[{i}]: {item}") [0]: 1 [1]: 2 [2]: 3 for i, item in enumerate(lp): print(f"[{i+1}]: {item}") [1]: 1 [2]: 2 [3]: 3 for i, item in enumerate(lp,1): print(f"[{i}]: {item}") [1]: 1 [2]: 2 [3]: 3 for i in range(1,100): print(i) 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 for i in range(1,101): print(i) 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 for i in range(1,101): if i % 2 == 1: print(i) 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 for i in range(1,101): if i % 2 == 0: print(i) 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 even_numbers = [i for i in range(1,101) if i % 2 == 0] even_numbers [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100] for i in range(1,101,2): print(i) 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99 for i in range(2,101,2): print(i) 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 >>> even_numbers = [i for i in range(2,101,2)] >>> even_numbers [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100] >>> jamie_list = [i for i in range(0,1001,20)] >>> jamie_list [0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 440, 460, 480, 500, 520, 540, 560, 580, 600, 620, 640, 660, 680, 700, 720, 740, 760, 780, 800, 820, 840, 860, 880, 900, 920, 940, 960, 980, 1000] >>> [i for i in range(0,101,5)] [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100] >>> [i ** 2 for i in range(0,101,5)] [0, 25, 100, 225, 400, 625, 900, 1225, 1600, 2025, 2500, 3025, 3600, 4225, 4900, 5625, 6400, 7225, 8100, 9025, 10000] >>> [item for item in 'hello, wolrd'] ['h', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'l', 'r', 'd'] >>> [item ** 4 for item in 'hello, wolrd'] Traceback (most recent call last): File "", line 1, in [item ** 4 for item in 'hello, wolrd'] TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int' >>> [item * 4 for item in 'hello, wolrd'] ['hhhh', 'eeee', 'llll', 'llll', 'oooo', ',,,,', ' ', 'wwww', 'oooo', 'llll', 'rrrr', 'dddd']