Why does this error get in the while loop? Although before the cycle I also appeal on a negative index
input_=[1,5,7,13,16,17,18,23,25,30,31,34] for i in range(len(input_)): j=i-1 print(i,j) print(input_[i], input_[j]) while ((input_[i] - input_[j])<3): j=j-1 Conclusion:
0 -1 1 34 Traceback (most recent call last): File "dasha.py", line 6, in <module> while ((input_[i] - input_[j])<3): IndexError: list index out of range
jvalue to the body of thewhile, everything will become clear. - mkkik