In every programming language, an array is represented as an array[index]. The index is the number that states the location number of a particular item in the memory location.

Since array uses sequential memory, therefore the index numbers are also continuous. It is quite obvious to note that the array indexing starts at 0 and ends at n-1, where n is the size of an array.

Python array

An array in Python is a linear data structure that contains an ordered collection of items of the same data type in the sequential memory location. There is no specific array object in Python because you can perform all the operations of an array using a  Python list.

We can define the list as a single-dimensional array using the following syntax.

array_name = [ ]

You can initialize the Python array using the following code.


data = [11, 21, 19, 18, 46]

#python #programming #python list

How to Implement Python 2D Array with Example
1.45 GEEK