In this python tuple program, we will return an empty set if no tuples are symmetrical.
Steps to solve the program
l = [(1, 5), (3, 4), (4, 9)]
print("Original list of tuples: ",l)
temp = set(l) & {(b, a) for a, b in l}
sym = {(a, b) for a, b in temp if a < b}
print("Tuples that are symmetric: ",sym)
Output :
Original list of tuples: [(1, 5), (3, 4), (4, 9)]
Tuples that are symmetric: set()