python lists vs arrays code example

Example 1: difference between arrays and lists in python

lists and arrays are used in Python 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.

Example 2: list vs array python

#a list in Python stores multiple values
fruits = ['apples','bananas','oranges','cherries']

Tags:

Java Example