Lists & Tuples

--Originally published at Python & pugs

This is a very easy topic and I’ll explain it in a very easy way.

To identify a list and a tuple just look at this example:

liststuples

A tuple can be write withouth the “[” “]”, and also you can use “(” “)”, so it is the same if you write:
x = 1,2,3,4

or

x = (1,2,3,4)

But for lists you’ll need to write it with “[” “]”

y = [5,6,7,8]

And now, you can use these lists and tuples in several ways, but I’m going to show the easiest way to use them, and we are going to ask for a number in a certain for position, and for this you need to know that python starts counting from 0.

liststuples2liststuples3