Difference between an array and a list in Python
-
What is the difference between a list and an array in Python List is a container of objects and can hold elements having different data types. Array is a container of objects and can hold elements of the same data type only. In python, array is not a built-in data type. It needs to be imported. There are two different libraries for array – array and numpy. Importing and using numpy array is most preferred. -
Differences between an array and a list List is a container of objects and can hold elements having different data types. Array is a container of objects and can hold elements of the same data type only. In python, array is not a built-in data type. It needs to be imported. There are two different libraries for array – array and numpy. Importing and using numpy array is most preferred.