The program is an implementation of set operations in Python. It creates two sets, s and val, and performs set operations like union, symmetric difference, and intersection on them.
Finally, all the sets are printed to show the result of set operations.
s = set() s.update(range(5, 15)) val = { 11, ("Python", "C"), ('J','O','E'),10 , 20 } print("Set 1 :",s) print("\nSet 2 :",val) print("Union : ",s.union(val)) print("Symmetric Difference :",s.symmetric_difference(val)) print("Intersection :",s.intersection(val))
Set 1 : {5, 6, 7, 8, 9, 10, 11, 12, 13, 14} Set 2 : {20, ('Python', 'C'), 10, 11, ('J', 'O', 'E')} Union : {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ('Python', 'C'), 20, ('J', 'O', 'E')} Symmetric Difference : {5, 6, 7, 8, 9, ('Python', 'C'), 12, 13, 14, 20, ('J', 'O', 'E')} Intersection : {10, 11}
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions