 # Python symmetric_difference_update()

The symmetric_difference_update() function in python first finds out the symmetric-difference of given sets and updates the first set(calling set) with the symmetric-difference values. The symmetric difference means the set of elements that are either in the first set or in the second set. It doesn't contain common elements in the set.

``````
A.symmetric_difference_update(B) #where A & B are sets
```
```

## symmetric_difference_update() Parameters:

The symmetric_difference_update() function takes sets as its parameter. If there are multiple sets, all that will be separated with commas.

Parameter Description Required / Optional
A & B The set to check for matches in Required

## symmetric_difference_update() Return Value

This function doesn't return any value it just updates the calling set with symmetric_difference of two sets. The second set remains unchanged.

## Examples of symmetric_difference_update() method in Python

### Example 1: Working of symmetric_difference_update() in Python

``````
X = { 1, 2, 3 }
Y= { 2, 3, 4 }

result = X.symmetric_difference_update(Y)

print('X =', X)
print('Y =', Y)
print('result =', result)
```
```

Output:

```
X = { 1, 4 }
Y = { 3, 4, 2 }
result = None
```

### Example 2: How symmetric_difference_update() works?

``````
X = {'a', 'b', 'c'}
Y = {'b', 'c', 'd' }

result = X.symmetric_difference_update(Y)

print('X =', X)
print('Y =', Y)
print('result =', result)
```
```

Output:

```
A = {'a', 'd'}
B = {'d', 'c', 'b'}
result = None
```
VIEW ALL
VIEW ALL
##### OtherTutorials
VIEW ALL 