Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Symmetric-difference/Python/symmetric-difference-1.py
Normal file
12
Task/Symmetric-difference/Python/symmetric-difference-1.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
>>> setA = {"John", "Bob", "Mary", "Serena"}
|
||||
>>> setB = {"Jim", "Mary", "John", "Bob"}
|
||||
>>> setA ^ setB # symmetric difference of A and B
|
||||
{'Jim', 'Serena'}
|
||||
>>> setA - setB # elements in A that are not in B
|
||||
{'Serena'}
|
||||
>>> setB - setA # elements in B that are not in A
|
||||
{'Jim'}
|
||||
>>> setA | setB # elements in A or B (union)
|
||||
{'John', 'Bob', 'Jim', 'Serena', 'Mary'}
|
||||
>>> setA & setB # elements in both A and B (intersection)
|
||||
{'Bob', 'John', 'Mary'}
|
||||
Loading…
Add table
Add a link
Reference in a new issue