Python Practice › Set Programs › Program 28
Symmetric difference in place
Write a Python program to update a set to the symmetric difference with another set.
Input
{1, 2, 3}, {3, 4}Output
{1, 2, 4}Approach
^=.
Solution
a = {1, 2, 3}a ^= {3, 4}print(a)Output
{1, 2, 4}Learn the concept
New to this topic? Read the lesson, then come back.