Answer the question
In order to leave comments, you need to log in
python pygame error: IndexError: list index out of range How to fix?
When the code tries to interact with this department, an error occurs IndexError: list index out of range
I have been suffering with this error for a long time and I can’t fix it in any way.
for i in range(len(Spider_right)):
for j in range(len(bullets_right)):
if Spider_right[i].colliderect(bullets_right[j]):
del Spider_right[i]
del bullets_right[j]
score += 1
Answer the question
In order to leave comments, you need to log in
in some of the indices it is necessary to put i-1 or j-1, or in several at once.
post all the code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question