Python Set Comparaison
set1 = {1, 3, 5}
set2 = {1, 3, 5}
set3 = {1, 2, 3}
print(set1 == set2) # True
print(set1 == set3) # False
Wissam
set1 = {1, 3, 5}
set2 = {1, 3, 5}
set3 = {1, 2, 3}
print(set1 == set2) # True
print(set1 == set3) # False
a = {1,2,3}
b = {3,4,5}
c = a.intersection(b)
print(c) # {3}
first_set = [10, 20, 30]
second_set = [10, 20, 30]
if len(first_set) == len(second_set):
if first_set == second_set:
print("Both sets are equal")
else:
print("Both sets are not equal")
else:
print("Both sets are not equal")