>>> word = "python" >>> word[0] 'p' >>> word[0] = 'P' Traceback (most recent call last): File "", line 1, in TypeError: 'str' object does not support item assignment >>> l = ['p', 'y', 't', 'h', 'o', 'n'] >>> l[0] 'p' >>> l[0] = 'P' >>> l ['P', 'y', 't', 'h', 'o', 'n'] >>> tup = (1, 3, 'two', 4.5) >>> print tup (1, 3, 'two', 4.5) >>> tup[1] 3 >>> len(tup) 4 >>> tup(0) Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object is not callable >>> tup[0] 1 >>> tup[0] = "new" Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object does not support item assignment >>> list = [1, 2, "two", 4.5] >>> print list [1, 2, 'two', 4.5] >>> print list[2] two >>> print list[5] Traceback (most recent call last): File "", line 1, in IndexError: list index out of range >>> list[2] = "tre" >>> list [1, 2, 'tre', 4.5] >>> table = [[1, 2, 4], [3, 6, 10]] >>> table [[1, 2, 4], [3, 6, 10]] >>> print table[0] [1, 2, 4] >>> table[0 ... ] [1, 2, 4] >>> table[0] = [-3, -2, -1] >>> table [[-3, -2, -1], [3, 6, 10]] >>> print table[0][] File "", line 1 print table[0][] ^ SyntaxError: invalid syntax >>> print table[0][0] -3 >>> table[1,0] Traceback (most recent call last): File "", line 1, in TypeError: list indices must be integers, not tuple >>> table[1][0] = 13 >>> table [[-3, -2, -1], [13, 6, 10]] >>> tup = 1,2 >>> tup (1, 2) >>> tup = 1,2,3,4 >>> tup (1, 2, 3, 4) >>> tup[2] 3 >>> tup[-1] 4 >>> tup2 = (5,4,3,2,1) >>> tup2 (5, 4, 3, 2, 1) >>> tup.append(tup2) Traceback (most recent call last): File "", line 1, in AttributeError: 'tuple' object has no attribute 'append' >>> tup = tup + tup2 >>> tup (1, 2, 3, 4, 5, 4, 3, 2, 1) >>> tup2 (5, 4, 3, 2, 1) >>> nestList = [[1, 2], [1, 4, 6], [3, 5, 10, 16]] >>> nestList[0][3] Traceback (most recent call last): File "", line 1, in IndexError: list index out of range >>> nestList[2][3] 16