Difference between list and tuples in Python and more such comparisons

In this article we will see key differences between commonly used terms in python. For example difference between tuple and list, difference between range and xrange and so on.

List and Tuples:

List:
– are mutable i.e. we can add, extend or update a list.
– generally are homogeneous┬ádata structures.


Tuples:
– are immutable i.e. we can not update a tuple.
– generally are heterogeneous data structure.
– is a sequence where position have semantic value.
– are more like records, collection of fixed number of fields.

Continue reading “Difference between list and tuples in Python and more such comparisons”