Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] Type "help", "copyright", "credits" or "license" for more information. >>> x=range(10) >>> x [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> x[1:4] [1, 2, 3] >>> x[3:] [3, 4, 5, 6, 7, 8, 9] >>> x[:3] [0, 1, 2] >>> x[:] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> x[0:10:2] [0, 2, 4, 6, 8] >>> x[0:10:3] [0, 3, 6, 9] >>> x[::3] [0, 3, 6, 9] >>> x[1:8:3] [1, 4, 7] >>> x[0:10:-2] [] >>> x[10:0:-2] [9, 7, 5, 3, 1] >>> x [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> y=x >>> z=x[:] >>> x [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> y [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> z [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> x[3]=55 >>> x [0, 1, 2, 55, 4, 5, 6, 7, 8, 9] >>> y [0, 1, 2, 55, 4, 5, 6, 7, 8, 9] >>> z [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> x=() >>> x () >>> type(x) >>> x=(8) >>> x 8 >>> type(x) >>> x=(8,) >>> x (8,) >>> type(x) >>> x(0) Traceback (most recent call last): File "", line 1, in TypeError: 'tuple' object is not callable >>> x[0] 8 >>> y=x >>> y (8,) >>> x (8,) >>> x=(8,3,5) >>> x (8, 3, 5) >>> y (8,) >>> x='string' >>> len(x) 6 >>> min(x) 'g' >>> max(x) 't' >>> sum(x) Traceback (most recent call last): File "", line 1, in TypeError: unsupported operand type(s) for +: 'int' and 'str' >>> x[3:] 'ing' >>> x[:3] 'str' >>> x[3] 'i' >>> x[2:3] 'r' >>> x[1:3] 'tr' >>> x[::2] 'srn' >>> x.find('ring') 2 >>> x[2] 'r' >>> x.find('ring',3,5) -1 >>> x.find('ring',2,6) 2 >>> x='tattleat' >>> x.find('at') 1 >>> x.rfind('at') 6 >>> x 'tattleat' >>> x.rfind('tt') 2 >>> x.find('tt') 2 >>> x=[[1,2,3],[4,5,6],[7,8,9]] >>> x [[1, 2, 3], [4, 5, 6], [7, 8, 9]] >>> y=[x,x,x] >>> y [[[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[1, 2, 3], [4, 5, 6], [7, 8, 9]]] >>> x[0][0] 1 >>> x[0][2] 3 >>> x [[1, 2, 3], [4, 5, 6], [7, 8, 9]] >>> x[2][0] 7 >>> x[2][:2] [7, 8] >>> x[:2][:2] [[1, 2, 3], [4, 5, 6]] >>> x[1] [4, 5, 6] >>> y=x[1] >>> y [4, 5, 6] >>> y[1]=99 >>> x [[1, 2, 3], [4, 99, 6], [7, 8, 9]] >>> x [[1, 2, 3], [4, 99, 6], [7, 8, 9]] >>> x=[y=[234,890,7239,48],z=[2423,5342]] Traceback (most recent call last): File "", line 1, in invalid syntax: , line 1, pos 5 >>> x[1] [4, 99, 6] >>> x[2] [7, 8, 9] >>> x[0] [1, 2, 3] >>> x [[1, 2, 3], [4, 99, 6], [7, 8, 9]] >>> x[0] [1, 2, 3]