Reputation: 11
For example:
A=set(frozenset[x,x+1]for x in range (10))
B=set()
C=set()
Result=set()
for B in A:
for C in A:
if B!=C:
Result.add(frozenset(B.intersection(C)))
#Error: descriptor 'intersection' for 'frozenset' objects doesn't apply to a 'types.GenericAlias' object
Upvotes: 0
Views: 641
Reputation: 11
Thank you @"user2357112 supports Monica", that was infact the Problem... if I interchange it with
frozenset({x,x+1})
it totally works.
Upvotes: 1
Reputation: 67
You can just use the .intersection() method:
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
z = x.intersection(y)
print(z)
Upvotes: 3