How can we define an array in Python?

If you want to work with an array in python, you will have to import a library like NumPy Library.

NumPy is a Python Library. It is used to working with arrays.

If you want to use NumPy Library, Firstly install NumPy using this command

pip install numpy

  1. import numpy  
  2. arr = numpy.array([1,2,3]) 
  3. Print(arr) 

you can import numpy as np, Instead of import numpy

Comments