IndexError: list assignment index out of range in python
dictionary, python
Solution
`actual_ans_dict` is an empty list. You are trying to set a value to `actual_ans_dict[data[0]]` but an element with this index doesn't exist. You can change the type of `actual_ans_dict` to dict:
actual_ans_dict = {}
for data in prsnobj.result:
actual_ans_dict[data[0]] = data[1]
print actual_ans_dict
Problem
IndexError: list assignment index out of range in python What am i doing wrong. I am an newbie ``` actual_ans_dict = [] for data in prsnobj.result: actual_ans_dict[data[0]] = data[1] print actual_ans_dict ```