Apr-14-2021, 03:17 PM

Hello

I have this list:

A [(7.5,), (17.5,), (22.5,), (25.0,), (27.5,), (30.0,), (37.5,), (40.0,)]

B [(17.5,), (22.5,), (25.0,), (27.5,), (30.0,), (37.5,), (40.0,), (42.5,)]

I want to find number of same elements in the list

I tried these methods but the result is always zero:

How can I find the common elements in 2 different list?

I have this list:

A [(7.5,), (17.5,), (22.5,), (25.0,), (27.5,), (30.0,), (37.5,), (40.0,)]

B [(17.5,), (22.5,), (25.0,), (27.5,), (30.0,), (37.5,), (40.0,), (42.5,)]

I want to find number of same elements in the list

I tried these methods but the result is always zero:

list1_as_set = set(A) intersection = list1_as_set.intersection(B) intersection_as_list = list(intersection)I also tried that one:

commonalities = set(A) - (set(A) - set(B))But the result is empty ..

How can I find the common elements in 2 different list?