I have this list:
list = [("a", 1), ("b", 2), ("a", 3), ("b", 1), ("a", 2), ("c", 1)]
I want to convert it into a dictionary which looks like:
{'a': [1, 3, 2], 'b': [2, 1], 'c': [1]}
I tried this:
for key, value is list:
if key in list_dictionary:
dict(list_dictionary)
else:
list_dictionary[key] = value
and the output came:
{'a': 1, 'b': 2, 'c': 1}
What should I do?