Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
Can anyone tell me how to define an array in Python?

1 Answer

0 votes
by (108k points)

For creating an array, you have to use the NumPy package. First, you have to import the package in Python using the following:

import numpy as np

a=np.array([2,3,4,5,6])

a

The output:

array([2, 3, 4, 5, 6])

If you are looking for an online course to learn Python, I recommend this Python Course by Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 14, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
asked Jul 10, 2020 in Python by ashely (50.2k points)
0 votes
1 answer

Browse Categories

...