a = [2,7,9]
b = [[7,9],[1,2],[2,9]]
How many pairs in the list [a]corresponds to a pair of tuples [b]
Notice the couple [7,9]and [2,9]in the list [a]. Even if a pair [1,2]contains a digit 2, it is not counted because both digits are not on the list [a]. The return value must be 2, len matching pairs.
len(filter(lambda l:if_in(b,l),a))
Need help creating an if_in function or an easier way to write this function in one. How can I make this function work regardless of size aor b.
source
share