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:
– are mutable i.e. we can add, extend or update a list.
– generally are homogeneous data structures.
>>> [x for x in range(10)]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
– 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.