Advertisements
Advertisements
Question
Give one point of difference between an array and a list in Python.
Distinguish Between
Advertisements
Solution
| Basis of Difference | Array | Python List |
|---|---|---|
| Data type of elements | Usually stores elements of the same data type. | Can store elements of different data types. |
| Size | Traditionally has a fixed size. | Has variable length; elements can be added or removed. |
| Storage | Stores contiguous values of a similar type. | Stores contiguous references (pointers) to objects. |
| Example | An array of integers | [4, "Good", 8.45, "k"] |
shaalaa.com
Is there an error in this question or solution?
