"""
Through the globals() function, one can bind a variable to a set
as illustrated below. name str variable was both bound to different
sets and used to modify these sets.
"""
name = "set"
set1 = set()
set2 = set()
set3 = set()
for i in range(1, 4):
globals()[name + str(i)].add(i) # access ith set and add value of i to it
print(set1) # {1}
print(set2) # {2}
print(set3) # {3}
x = [1, 1, 2, 3]
y = set(x)
print(y) # {1, 2, 3}
"""
Through the globals() function, one can bind a variable to a set as illustrated below.
name str variable was both bound to different sets and used to modify these sets.
"""
name = "set"
set1 = set()
set2 = set()
set3 = set()
for i in range(1, 4):
globals()[name + str(i)].add(i) # access ith set and add value of i to it
print(set1) # {1}
print(set2) # {2}
print(set3) # {3}