if this is given on a homework assignment:
import numpy as np
room_matrix = \
np.array(
[[6, 3, 4, 1],
[5, 2, 3, 2],
[8, 3, 6, 2],
[5, 1, 3, 1],
[10, 4, 7, 2]])
and the task is:
write an expression that retrieves the following submatrix from room_matrix:
array([[2,3],
[3,6]])
I have done this so far:
a=room_matrix[1,1:3]
b=room_matrix[2,1:3]
then I print "a" and "b" and the output is:
[2 3]
[3 6]
but I want them to be executed as an actual subarray like so:
array([[2,3],
[3,6]])
Can I concatenate "a" and "b"? Or is there another way to extract a sub array so that the output actually shows it as an array, and not just me printing two splices? I hope this makes sense. Thank you.