The symmetric difference of two sets is the set of elements which are in either of the sets but not in both of them.
Symmetric Difference is marked in Green
symmetric_difference() method returns a new set which contains symmetric difference of two sets. The symmetric_difference_update() method updates the set calling symmetric_difference_update() with the symmetric difference of sets.
The symmetric_difference takes a single “set” as a argument.
This method returns None (which indicates absence of a return value). It only updates the set calling symmetric_difference_update() with the symmetric difference of sets.
('A = ', set(['e', 'o', 'p', 'r', 'w'])) ('B = ', set(['a', 'r', 'e', 'o', 'n'])) ('result = ', None)
('A = ', set(['s', 'b'])) ('B = ', set(['y', 'b', 'u', 'n'])) ('result = ', None)
- Python - Read blob object in python using wand library
- twitter-text-python (ttp) module - Python
- Python | PRAW - Python Reddit API Wrapper
- Important differences between Python 2.x and Python 3.x with examples
- Python | Merge Python key values to list
- MySQL-Connector-Python module in Python
- Reading Python File-Like Objects from C | Python
- Python | Convert list to Python array
- Python | Index of Non-Zero elements in Python list
- Python | Add Logging to Python Libraries
- Python | Sort Python Dictionaries by Key or Value
- Python | Add Logging to a Python Script
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Visualizing O(n) using Python
- Python vs PHP
- Use of min() and max() in Python
- SHA in Python
- set add() in python
- C Vs Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.