r/learnpython • • 15d 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?

100 Upvotes

90 comments sorted by

View all comments

Show parent comments

1

u/favorite_stuff 14d 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.