belongs to collection: Python Set Exercises
Given:
set1 = {10, 20, 30, 40, 50} set2 = {30, 40, 50, 60, 70}
Expected output:
{70, 10, 20, 60}
Hint:
Use the symmetric_difference_update() method of a set.
symmetric_difference_update()
Solution:
set1 = {10, 20, 30, 40, 50} set2 = {30, 40, 50, 60, 70} set1.symmetric_difference_update(set2) print(set1)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Hint:
Use the
symmetric_difference_update()
method of a set.Solution:
need an explanation for this answer? contact us directly to get an explanation for this answer