I have a weird problem when trying to append a list of elements to a dictionary. I am not sure what I am doing wrong. Any help is very much appreciated.
here is what I have:
keys = ['a', 'b', 'c']
d = dict.fromkeys(keys, [])
d['a'].append(10)
d['a'].append(11)
d['b'].append(30)
print(d)
the output I am getting is:
{'a': [10, 11, 30], 'b': [10, 11, 30], 'c': [10, 11, 30]}
I would expect:
{'a': [10, 11], 'b': [30], 'c': None}
Thank you