Python 3.2.3 (default, Feb 20 2013, 14:44:27) [GCC 4.7.2] on linux2 Type "copyright", "credits" or "license()" for more information. >>> ================================ RESTART ================================ >>> E ====================================================================== ERROR: test_square_list (__main__.TestMarch21) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/good_stuff/documents/teaching/CISC106/spring-2013/examples/march21/march21_tests.py", line 26, in test_square_list self.assertEqual(square_list([1, 2, 3, 4, 5]), [1, 4, 9, 16, 25]) NameError: global name 'square_list' is not defined ---------------------------------------------------------------------- Ran 1 test in 0.006s FAILED (errors=1) >>> [1, 2, 3] [1, 2, 3] >>> x = [1, 2, 3] >>> x [1, 2, 3] >>> x + [4] [1, 2, 3, 4] >>> x [1, 2, 3] >>> y = 5 >>> y + 5 10 >>> y 5 >>> y = y + 5 >>> x = x + [4] >>> x [1, 2, 3, 4] >>> x [1, 2, 3, 4] >>> x = [0] + x >>> x [0, 1, 2, 3, 4] >>> #no brackets around the thing we're adding: >>> x = x + 5 Traceback (most recent call last): File "", line 1, in x = x + 5 TypeError: can only concatenate list (not "int") to list >>> x [0, 1, 2, 3, 4] >>> #gives us a type error >>> ================================ RESTART ================================ >>> . ---------------------------------------------------------------------- Ran 1 test in 0.008s OK >>> ================================ RESTART ================================ >>> .. ---------------------------------------------------------------------- Ran 2 tests in 0.009s OK >>> ================================ RESTART ================================ >>> E.. ====================================================================== ERROR: test_maybe_inner_product (__main__.TestMarch21) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/good_stuff/documents/teaching/CISC106/spring-2013/examples/march21/march21_tests.py", line 35, in test_maybe_inner_product 48)) TypeError: maybe_inner_product() takes exactly 1 positional argument (2 given) ---------------------------------------------------------------------- Ran 3 tests in 0.016s FAILED (errors=1) >>> ================================ RESTART ================================ >>> ... ---------------------------------------------------------------------- Ran 3 tests in 0.014s OK >>> ================================ RESTART ================================ >>> .... ---------------------------------------------------------------------- Ran 4 tests in 0.017s OK >>> ================================ RESTART ================================ >>> .... ---------------------------------------------------------------------- Ran 4 tests in 0.018s OK >>> (1, 2, 3, 4) (1, 2, 3, 4) >>> y = (1, 2, 3, 4) >>> #indexing into a tuple: >>> y[2] 3 >>> #cannot change a tuple, it is IMMUTABLE >>> y[2] = 'three' Traceback (most recent call last): File "", line 1, in y[2] = 'three' TypeError: 'tuple' object does not support item assignment >>> y[:] (1, 2, 3, 4) >>> y[1:] (2, 3, 4) >>> y[:2] (1, 2) >>> y[1:3] (2, 3) >>> (1) 1 >>> (1,) (1,) >>> [1] [1] >>> (1) != (1,) True >>> z = 5 >>> w = 10 >>> z 5 >>> w 10 >>> (z, w) (5, 10) >>> z, w (5, 10) >>> z, w = w, z >>> #what will z be now? >>> z 10 >>> w 5 >>> tmp = z >>> z = 2 >>> z = w >>> #that z = 2 was a typo >>> w = tmp >>>