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