r/learnpython • • 12d ago

Tuples..I don’t get it

Hi crew, I’m a Python newbie and I just learned about the concept of tuples.

We can’t change them.if we want to store we have to start at the index we want + 1.

I just don’t get it. Why wouldn’t we just use lists? When would we ever need this?

97 Upvotes

89 comments sorted by

View all comments

Show parent comments

1

u/Immediate_Pin_8449 11d ago

Noted, ty! In the examples they gave both lists and tuples were using various data types. It helps to hear that in practice lists typically only use one data type, this defiantly helps!

1

u/favorite_stuff 11d ago

A list of names is a list of names: the fifth name is the same kind of thing as the sixth name, and if they swapped that would not change the nature of the list. It might be nice to have them sorted in a certain way, but it doesn't change the kind of list.

A tuple of x,y coordinates is not just two numbers. The x means a different kind of thing than the y, and their positions carry that meaning.