I am trying to use defaultdict(list) as,
dict = defaultdict(list)
dict['A'][1] = [1]
or
dict['A'][1] = list([1])
I got an error,
IndexError: list assignment index out of range
if I do
dict['A'][1].append(1)
IndexError: list index out of range
I am wondering what is the issue here.
[][1] = [1]. An empty list doesn't have a1index to assign to.list.appendis how it's done.