symmetric_difference_update() method in Python set

All set methods

Update the main set with difference elements only.
  • Video Tutorial on Set


Using symmetric_difference_update() method

A={'a','b','c'}
B={'a','y','z'}
A.symmetric_difference_update(B)
print(A)
Output
{'y', 'b', 'c', 'z'}

symmetric_difference_update() method

Using string ( iterable object ) with symmetric_difference_update() method
A={'a','b','c','x','y'}
B='Alex'
A.symmetric_difference_update(B)
print(A)
Output
{'y', 'l', 'A', 'e', 'b', 'a', 'c'}
Using list with symmetric_difference_update() method.
A={'a','b','c'}
B=['a','x','y']
A.symmetric_difference_update(B)
print(A)
Output
{'y', 'x', 'b', 'c'}
All set methods Questions with solutions on set
difference() union() intersection() symmetric_difference()


plus2net.com



Post your comments , suggestion , error , requirements etc here





Python Video Tutorials
Python SQLite Video Tutorials
Python MySQL Video Tutorials
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer