I have multiple tuples stored in a set, and I'm trying to add two duplicate tuples to the set through a nested for loop which basically iterates through another bunch of tuples and checks for a condition in the tuple, then adds the tuple to the set if the tuple meets the condition. However, some tuples are duplicate and I'm noticing the duplicates aren't being added.
2 Answers
A set can not contain duplicates. That is the point of a set. If you want duplicates, consider using a list instead.
Set by definition is unordered collections of unique elements, so they don't allow duplicates. Please check the python's documentation.