Symmetrische Differenz
Einfache Sprache
“A ohne B“ vereinigt mit „B ohne A”
Def. Symmetrische Differenz
Sei $A,B$ Mengen. Die Symmetrische Differenz $\mathbin{\vartriangle}$ zwischen $A$ und $B$ ist definiert als
$$A\mathbin{\vartriangle}B := (A\setminus B)\cup (B\setminus A) = (A\cup B)\setminus(A\cap B)$$
Algorithmus
1def symmetric_difference(A,B):
2 """
3 Multiplies two numbers and returns the result.
4
5 Args:
6 A (set): The first Set.
7 B (set): The second Set.
8
9 Returns:
10 set: The symmetric difference of A and B.
11 """
12 return(A.setminus(B)).union(B.setminus(A))
Home: