Instagram
youtube
Facebook
Twitter

Create a NumPy Array of Zeros with Shape (3, 4)

A Create a NumPy Array of Zeros with Shape (3, 4)

Short Description of the Program:
This program creates a 2D NumPy array filled with zeros, having 3 rows and 4 columns.

Explanation:

  • import numpy as np
    Imports the NumPy library and gives it an alias np for easy use.

     
  • np.zeros((3, 4))
    Creates a 2D array of shape (3, 4) where every element is initialized to 0.0.

     
  • print(array_zeros)
    Displays the resulting array.

Program:

import numpy as np

array_zeros = np.zeros((3, 4))

print(array_zeros)