set.update() in python
"update()" function is used to find all the elements in the given two list. It will remove the duplicate elements and will update all the elements in the specified set.
Syntax:
set.update(set_value)
Example-1
n = {10, 30, 50} m = {10, 30, 100} n.update(m) print(n)
Output
{50, 100, 10, 30}
Example-2
n = {10, 30, 50} m = {10, 20, 40} n.update(m) print(n)
Output
{50, 20, 40, 10, 30}
Example-3
n = {"A", "B", "C"} m = {"A", "B", "D"} n.update(m) print(n)
Output
{'A', 'D', 'B', 'C'}