•what are 3 dimensional array? how we can access the elements from 3d array and how to assign the value of aaray
《 answer according to c language 》
Answers
We will encounter arrays of varying dimensionalities:
# A 0-D array
np.array(8)
# A 1-D array, shape-(3,)
np.array([2.3, 0.1, -9.1])
# A 2-D array, shape-(3, 2)
np.array([[93, 95],
[84, 100],
[99, 87]])
# A 3-D array, shape-(2, 2, 2)
np.array([[[0, 1],
[2, 3]],
[[4, 5],
[6, 7]]])
Similar to Python’s sequences, we use 0-based indices and slicing to access the content of an array. However, we must specify an index/slice for each dimension of an array:
>>> import numpy as np
# A 3-D array
>>> x = np.array([[[0, 1],
... [2, 3]],
...
... [[4, 5],
... [6, 7]]])
# get: sheet-0, both rows, flip order of columns
>>> x[0, :, ::-1]
array([[1, 0],
[3, 2]])
One-dimensional Arrays
Let’s begin our discussion by constructing a simple ND-array containing three floating-point numbers.
yes answer correct answer