Lists and Tuples
In this posts we intend to introduce the use of lists and tuples for those who are new to programming or are migrating from some other language, as well as those who have been in Python for a while and want to expand their knowledge and improve their code. As a first approach, it could be said that lists and tuples are what we in other languages call vectors or arrays. However, they have several differences that we'll learn through this tutorial.
A list is not the same as a tuple. Both are an ordered set of values. Values can be any Python object: numbers, strings, functions, classes, instances, etc., and even other lists and tuples. The difference is that lists have a series of additional functions that allow an extensive handling of the values they contain. On the contrary, the content of a tuple cannot be changed once created. Thus we can state that lists are dynamic or mutable, while tuples are static or immutable. Let's start with lists.