"IndexError: list index out of range" in very simple 3 lines of Python code
It's not clear what exactly you're trying to do. When you iterate over an iterable like a list with
for i in my_list:
each i
is each member of the list, not the index of the member of the list. So, in your case, if you want to print each member of the list, use
for i in my_list:
print(i)
Think about it: what if the 3rd member of the list was 9
, for example? Your code would be trying to print my_list[9]
, which doesn't exist.