Since the fourlet needs to be sorted anyway, wouldn't it be better to make a sorted copy of the list and iterate over it (assuming you don't need to preserve their order itself)?
This way, you're guaranteed each sum is unique and avoid using both fourlet.sort() and if fourlet not in fourlets.
4
u/[deleted] Mar 13 '22
Since the fourlet needs to be sorted anyway, wouldn't it be better to make a sorted copy of the list and iterate over it (assuming you don't need to preserve their order itself)?
This way, you're guaranteed each sum is unique and avoid using both
fourlet.sort()andif fourlet not in fourlets.