Difference between Lists and Tuples in Python

List Tuple
List objects are mutable objects. Which means can be changed after its created Tuple objects are immutable objects. Which means can’t be changed after its created
Lists have order Tuple has structure
Iterating the list is slower Iterating the tuple is faster
List objects are not used as keys for the dictionary Tuple objects which contains immutable objects can be used as key for the dictionary
If the data changes frequently then it is recommended to represent that data by using list If the data doesn’t change then it is recommended to represent the data by using tuple
We can add items, delete item from list We can not add or delete items from tuple
Lists are not fixed size Tuples have fixed size
Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: