In [ ]:
In [ ]:
import numpy as np
z1 = np.zeros((5, 10)).tolist()
np.testing.assert_allclose(z1, make_matrix(5, 10))
z2 = np.zeros((7, 3)).tolist()
np.testing.assert_allclose(z2, make_matrix(7, 3))
Write a function that tests whether every element of a list is even or not. For each individual element of the list, you need to evaluate whether or not that element is even and add the outcome of that test to a list (yep, a list of booleans).
is_even_list
In [ ]:
In [ ]:
import numpy as np
t1 = [1, 2, 3, 4, 5, 6, 7]
a1 = [False, True, False, True, False, True, False]
np.testing.assert_array_equal(a1, is_even_list(t1))
t2 = [7, 13, 19, 29, 37, 42, 100, 101]
a2 = [False, False, False, False, False, True, True, False]
np.testing.assert_array_equal(a2, is_even_list(t2))