Please answer questions where appropriate. Let x be a numpy array with 4 rows and 4 columns:
Fantastic news! We've Found the answer you've been seeking!
Question:
Please answer questions where appropriate.
Let x be a numpy array with 4 rows and 4 columns:
x = numpy.array( [[ 1, 2, 3, 4],
[ 5, 6, 7, 8],
[ 9, 10, 11, 12],
[13, 14, 15, 16]])
What is the result of the following operations (answer questions A-L)? Please append with detailed comments about why.
A. y = x[:, 2]
B. y = x[-1,:2]
C. y = x[:, [True, False, False, True]]
D. y = x[0:2, 0:2]
E. y = x[[0, 1, 2], [0, 1, 2]]
F. y = x[0]**2
G. y = x.max(axis=1)
H. y = x[:2, :2] + x[:2,2:]
I. y = x[:2, :3].T
J. y = x[:2, :3].reshape((3, 2))
K. y = x[:, :2].dot([1, 1])
L. y = x[:, :2].dot([[3, 0], [0, 2]])
Related Book For
Finite Mathematics and Its Applications
ISBN: 978-0134768632
12th edition
Authors: Larry J. Goldstein, David I. Schneider, Martha J. Siegel, Steven Hair
Posted Date: