set1 = {1, 4, 5, 6} set2 = {1, 2, 3} set3 = set1.union(set2) print(set3)
Here is what the above code is Doing:
1. We create two sets, set1 and set2.
2. We use the union() method to combine the two sets.
3. We print the result.
set1 = {1, 4, 5, 6} set2 = {1, 2, 3} set3 = set1.union(set2) print(set3)
Here is what the above code is Doing:
1. We create two sets, set1 and set2.
2. We use the union() method to combine the two sets.
3. We print the result.