I ran into a problem as described in this link. While using the dict comprehension I typed
keys = [x for x in range(21)]
value = [0,0]
dict1 = {key: value for key in keys}
instead of:
keys = [x for x in range(21)]
value = [0,0]
dict1 = {key: list(value) for key in keys}
In the former case, the problem remains. All the key values point to the same list. Why does this happen? In essence, what I don't understand is how does list([0,0]) not create a list as [[0,0]]?
EDIT: I understand that list(arg) takes only 1 argument. But what does it mean to run list over a list?