Difference between array and list? 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: diff between array and list

The main difference between these two data types is the operation you can perform on them. Arrays are specially optimised for arithmetic computations so if you’re going to perform similar operations you should consider using an array instead of a list.
Also lists are containers for elements having differing data types but arrays are used as containers for elements of the same data type.