I have a list of sets [{'1'}, {'2','8'}, {'3','9', '1'}]. I want to loop through this list and find the union of all of these sets. I have done the following but my set maintains empty:
my_set = set()
for i in [{'1'}, {'2','8'}, {'3','9'}]:
  print(i)
  my_set.union(set(i))
  print(my_set)
print(my_set)
The output is the following:
{'1'}
set()
{'8', '2'}
set()
{'9', '3'}
set()
set()
Note:
Please fix my loop and do not propose a shortcut that does not use a loop and union.