0

Learning Python from some days back, and have confused about Python Array and Python Lists, please help me to understand this.
Thank You.

Comments
  • 1
    Arrays need to be declared whereas lists need not. If you want to perform arithmetic operations on them or store large amounts of data, use arrays, for they store data in a more compact and efficient manner compared to lists. Else using lists may be a better idea for being idiomatic to Python, well as, unlike arrays (which are one-dimensional and linear), have the capability of both storing heterogeneous data and multidimensionality.
  • 0
    Array -> 1,2,3,4,5
    List - [1,2,3,4,5]

    Else you can understand
  • 0
    @Eklavya Is Python List and Python array are same?
  • 0
    @andrewsmith see my answer. In short: no.
  • 0
    @andrewsmith Lists and arrays are used to store data(any data type- strings, integers, etc), both can be indexed and iterated also. ... Arrays need to be declared whereas lists do not need declaration because they are a part of Python's syntax. This is the reason lists are more often used than arrays.
Add Comment