I need help to write a function that:
- takes as input set of tuples
- returns the number of tuples that has unique numbers
Example 1:
# input:
{(0, 1), (3, 4), (0, 0), (1, 1), (3, 3), (2, 2), (1, 0)}
# expected output: 3
The expected output is 3, because:
(3,4)and(3,3)contain common numbers, so this counts as 1(0, 1),(0, 0),(1, 1), and(1, 0)all count as 1(2, 2)counts as 1
So, 1+1+1 = 3
Example 2:
# input:
{(0, 1), (2, 1), (0, 0), (1, 1), (0, 3), (2, 0), (0, 2), (1, 0), (1, 3)}
# expected output: 1
The expected output is 1, because all tuples are related to other tuples by containing numbers in common.
this code works for me but check it maby there edge cases how this solution?
image