d = {
0:{1,2,3},
1:{567},
2:{2,3,5,8},
3:{4,5,7,9},
4:{6,7,8}
}
I would like to compare the value of the first k-v pair with the key of the next k-v pair.
Example:
To check if 1
exists in {1,2,3}
or 2
exists in {567}
If it does exist then I would like to delete the k that exists in the value.
Output should look like:
d = {
0:{1,2,3},
2:{2,3,5,8}
}
I have tried using dictionary iterators with various permutations and combinations, but with no result. What would be the best way to achieve the result?