The following Python code demonstrates how to create a one-dimensional array using NumPy:
import numpy as np
# Create a 1D array
arr = np.array([1, 2, 3, 4, 5])
print(arr)
code
Discover how to create a one-dimensional array in Python using NumPy. This simple example highlights the process of defining and printing a 1D array.
The following Python code demonstrates how to create a one-dimensional array using NumPy:
import numpy as np
# Create a 1D array
arr = np.array([1, 2, 3, 4, 5])
print(arr)