import numpy as np readings = np.arange(1, 21).reshape(4, 5) single = readings[2, 3] row = readings[2, :] column = readings[:, 3] window = readings[1:3, 2:5] stepped = readings[::2, ::-1] print("readings:") print(readings) print("single readings[2, 3]:", single) print("row readings[2, :]:", row) print("column readings[:, 3]:", column) print("window readings[1:3, 2:5]:") print(window) print("stepped readings[::2, ::-1]:") print(stepped) print("window shares memory:", np.shares_memory(readings, window)) assert single == 14 assert row.tolist() == [11, 12, 13, 14, 15] assert column.tolist() == [4, 9, 14, 19] assert window.tolist() == [[8, 9, 10], [13, 14, 15]] assert stepped.tolist() == [[5, 4, 3, 2, 1], [15, 14, 13, 12, 11]] assert np.shares_memory(readings, window) print("indexing checks passed")