Write a NumPy program to create a three-dimension array with shape (3,5,4) and set to a variable
- برمجة بايثون
- 2021-09-11
- mhanasmh00489829403
الأجوبة
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]]]
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال