For python beginners, the differences between lists and tuples might not be as clear as to those who already got some experience using them.
Let’s review the key differences between the two. hopefully it will help you choose the right type in your code and understand that although this post called ‘lists vs. tuples’ there is no real match here. each type has his own use case.
Mutability talks about the capability of object to change or alter. This is one of noticeable difference between the two types.
First, let’s use list:
>>> my_list = [1,2,3]
>>> my_list = 9
>>> print my_list
[1, 2, 9]
Now let’s try the same on tuple: