ReferenceSet methods
set.symmetric_difference()
What is in one set but not both.
Signature
a.symmetric_difference(b) or a ^ bParameters
| Name | Means |
|---|---|
b | another set |
Returns
A new set.
Example
Python
print(sorted({1, 2, 3} ^ {3, 4}))Output
[1, 2, 4]
Basics
Strings
Collections
Functions
Classes and objects
Modules and the standard library
Files and errors
Beyond the basics
ReferenceSet methods
What is in one set but not both.
a.symmetric_difference(b) or a ^ b| Name | Means |
|---|---|
b | another set |
A new set.
print(sorted({1, 2, 3} ^ {3, 4}))Output
[1, 2, 4]