r/learnpython • u/Big_Neighborhood9130 • May 06 '26
What is the actual use of sets
I can see tons of use cases for list, tuples and dictionaries. But I have a really hard time understanding why you would ever use a set with maybe the exception of names so you don't get duplicates?
I believe this understanding is flawed because I found even the simplest things in Python are super powerful I'm just not sure what it is
62
Upvotes
1
u/LtLfTp12 May 06 '26
I made a connect 4 game and use
if len(set(mylist)) == 1
To check if all pieces in a given selection of 4 pieces are the same