Representation of arrays using NumPy

A simple array can be represented by using NumPy:  

Result:

Explanation:

  1. import numpy as np: This line imports the NumPy library and gives it the alias np. This is a common convention to make it easier to refer to NumPy functions and classes in the code.
  2. frame = np.array([[0,0,0],[0,0,0],[0,0,0]]): This line creates a 3×3 NumPy array filled with zeros. It uses the np.array() function to create a NumPy array from a nested Python list containing three lists, each with three zeros. So, frame becomes a 3×3 array filled with zeros.
  3. print(frame): This line prints the contents of the frame array to the console. Since frame is initialized with zeros, it will print:

Leave a comment

Your email address will not be published. Required fields are marked *