Instagram
youtube
Facebook
Twitter

Create 3D NumPy Array of Random Values

A Create 3D NumPy Array of Random Values ? 
Code Explanation:

Library Import: numpy is imported as np to work with arrays and random number functions.
Create Random Array: np.random.rand(2, 3, 4) generates a 3D NumPy array with random float values between 0 and      1.
Shape of Array: The shape of the array is (2, 3, 4), meaning it has 2 blocks, each with 3 rows and 4 columns.
Store Result: The generated 3D array is stored in the variable arr.
Display Output: print(arr) prints the entire 3D array with random values.

 

Program:

import numpy as np

arr = np.random.rand(2, 3, 4)

print(arr)