Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (47.6k points)

How do I declare an array in Python?

I can't find any reference to arrays in the documentation.

1 Answer

0 votes
by (106k points)

There are many ways to declare Array in Python some of them are as follows:-

abc = []

Here, abc refers to an empty list.

It is an assignment, not a declaration.  We know Python is dynamically typed so there is no way that we can say that this variable will never refer to anything other than a list. In Python, the default built-in type is called a list, not an array.

Another way to create an array in Python is to use the following method :

from array import array

intarray = array('i')

Related questions

0 votes
1 answer
asked Oct 11, 2019 in Python by Sammy (47.6k points)
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.2k users

Browse Categories