You know Python, this is C++





Lists in Python

>>> A = [ 0, 1, 2, 3, 4] >>> print(A) [0, 1, 2, 3, 4] >>> print(len(A)) 5 >>> A[2] = 777 >>> print(A) [0, 1, 777, 3, 4] >>> A[7] = 42 Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: list assignment index out of range



Lists in Python (cont'd)

>>> print(A) [0, 1, 777, 3, 4] >>> B = A[1:4] >>> print(B) [1, 777, 3] >>> B[1] = 2 >>> print(B) [1, 2, 3] >>> print(A) [0, 1, 777, 3, 4] >>> A = [ 1, 2, 3] >>> A.append(17) >>> print(A) [1, 2, 3, 17] >>> A.insert(1,42) >>> print(A) [1, 42, 2, 3, 17] >>>



C++ arrays