Write a NumPy program to create a three-dimension array with shape (3,5,4) and set to a variable
import numpy as np nums = np.array([[[1, 5, 2, 1], [4, 3, 5, 6], [6, 3, 0, 6], [7, 3, 5, 0], [2, 3, 3, 5]], [[2, 2, 3, 1], [4, 0, 0, 5], [6, 3, 2, 1], [5, 1, 0, 0], [0, 1, 9, 1]], [[3, 1, 4, 2], [4, 1, 6, 0], [1, 2, 0, 6], [8, 3, 4, 0], [2, 0, 2, 8]]]) print("Array:") print(nums)
Sample Output:
Array: [[[1 5 2 1] [4 3 5 6] [6 3 0 6] [7 3 5 0] [2 3 3 5]] [[2 2 3 1] [4 0 0 5] [6 3 2 1] [5 1 0 0] [0 1 9 1]] [[3 1 4 2] [4 1 6 0] [1 2 0 6] [8 3 4 0] [2 0 2 8]]]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer