![[Image: result.png]](https://i.ibb.co/G2jWRm7/result.png)
I want to check if any of the tuples my list contain the specific variables “x” and “y”.
If tuple 1 contain “x”,”x” and tuple 2 contain “y”, “y” return should be false.
But if tuple 3 contain “x”,”y,” return should be true.
Also I don’t want the last element of any tuple to take part in the comparison.
def check(lst, x, y): return any(x in tpl and y in tpl for tpl in (x[:-1] for x in lst))I am using that comparison function. However the problem is this:
* Added nodes: "a" and "b"
* Added edges: (a,b) and (b,b)
However the edge (a,a) comes back as true when the tuple ('a','a',1) don't exist.
![[Image: error.png]](https://i.ibb.co/zJpNMvj/error.png)