0

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

2 Answers2

3

You can just use the .intersection() method:

x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}

z = x.intersection(y)

print(z)
marky004
  • 67
  • 8
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 12 '22 at 14:05
1

Thank you @"user2357112 supports Monica", that was infact the Problem... if I interchange it with

frozenset({x,x+1})

it totally works.