Python: Does the set.add() function not add duplicates?

python, set

Solution

A set can not contain duplicates. That is the point of a set. If you want duplicates, consider using a list instead.

Problem

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.

Original source

Related problems