9951 explained code solutions for 126 technologies


python-scipyHow can I use Python and NumPy together to implement a tutorial from Javatpoint?


Python and NumPy can be used together to implement a tutorial from Javatpoint. The following example code block shows how to use Python and NumPy together to create a 2D array:

import numpy as np

# Create a 2D array
arr = np.array([[1, 2, 3],
                [4, 5, 6]])

# Print the array
print(arr)

Output example

[[1 2 3]
 [4 5 6]]

The code consists of the following parts:

  1. The first line imports the NumPy library into the program.
  2. The second line creates a 2D array with the given values.
  3. The third line prints the array.

Helpful links

Edit this code on GitHub