Set, Set In Python, Python Programming, Data Science, Artificial Intelligence.
Output {1,2,3,4,5,6,7,8} # Intersection(&) s1 & s2 # Output {4,5} # Difference(-) s1 - s2 # Output {1,2,3} s2 - s1 # Output {6,7,8} # Symmetric Difference(^) s1 ^ s2 # Output {1,2,3,6,7,8} # Membership Test 1 not in s1 # Output True # Iteration for i in s1: print(i) # Output 1 2 3 4 5 Set Function: