New course! Every coder should learn Generative AI!
Try a free lesson+ 1
what's the difference between a list and an array
list or array
4 Answers
+ 2
in python, list is a collection of several data items which maybe of similar type or maybe dissimilar type.
whereas, the array is collection of similar data items..
there is no multidimensional array in Python. this can implement by list..
+ 1
A list can contain different data types but array can only contain similar data types
+ 1
A list can contain different data types (integers, floats, strings, lists, etc.), while arrays contain only one data type (the first one in the index; it can be anything "listable"). Arrays are much more useful when you have few data types to work with as they are usually faster (noticeable on slower devices).
0
list is 1D while array is 2D. imagine excel sheet as array, with data on x-axis and y-axis.