Attempting to append to a list by assigning to an element outside the range of the list leads to IndexError
lst =  # let's append one item lst = 'cbg' # IndexError :(
The full error message is “IndexError: list assignment index out of range”.
The implicit (but wrong) assumption is either that the list will automatically expand to fit the new index, or that
lst[len(lst)] = val is somehow special-cased.
The solution is to use