I'm trying to do a function that returns the intersection between two sets:
def intersecao(conjuntoA, conjuntoB):
inter = [x for x in range(1,12) if x in conjuntoA and conjuntoB]
return inter
a = [2,4,6,7,10]
b = [3,4,6,8,10,11]
print(intersecao(a,b))
This function should return: [4,6,10] But it is returning: [2, 4, 6, 7, 10] I have tried other than by list understanding, but the result is the same ... Could someone point out where the error is by courtesy? Pq to turning into binary I already tried, and still not true: /