When you perform this:
A = [1,2,3,4,5]
i = 0
while i < len(A):
i += 1
print(A[i]) # A[1], A[2], A[3], A[4], A[5]
A[5] will be out of bound since index start from zero.
This might be what you expect:
A = [1,2,3,4,5]
i = 0
while i < len(A):
print(A[i]) # A[0], A[1], A[2], A[3], A[4]
i += 1 # At the end of loop, i is equal to 5 and then exit the while loop.
Here, A[4] is defined, which is 5.