Both tuples and lists are bundles of data bound together under a single index. The difference radiates in both the syntax and the fact that the tuple is immutable, and the list can be altered.

The difference in syntax between a list and a tuple is that to create a list you use “[ ]” and to create a tuple you use “( )”. Plus tuples are defined as “Heterogeneous data structures” and lists are defined as “Homogeneous sequences that have an order”

The use you most probably will use the tuple as reference data, since the values inside it cannot be modified; the list in the other hand can have the values inside it changed, move around, add new values and eliminate existing ones.

If you remember the mastery about “For” loops, in the example we used a list named “L” containing the values [1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 5]. For that program we could use a tuple as well since the “for” only checks for the value within the list, but it doesn’t modify it.

There are a whole bunch of things you can do with lists and tuples, like splitting and indexing them, for a whole list of the things you can do and how to do them please visit this link: http://www.tutorialspoint.com/python/python_lists.htm

You should be very careful not to use lists instead tuples or the other way around since even if you ARE able to do some things with both without negative results, not all of their functions are the same, tuples are more oriented towards indexing and lists are fore managing data.

Lists and tuples have positions, or spaces, and they store the values they are given in those. Those positions start with 0, then 1, next 2 and so on till they cover the length they are needed. So if you need the value stored in the tenth position of a list, you would need to call for the ninth value, since the counter starts from zero instead of one.

Another important thing is that they can contain any amount of data, and they don’t care about dta types, you can just throw integers, floats and strings inside a list and it will be just fine, just be careful when trying to mess around with the information itself, the list doesn’t have a problem with it but other parts of your code may.

CC BY 4.0 Creation and use of Tuples and Lists in Python by juansalvadorfernandez is licensed under a Creative Commons Attribution 4.0 International License.