Home » Python » python – the maximum size is 36, why index 5 is out of bound?-Exceptionshub

python – the maximum size is 36, why index 5 is out of bound?-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

I have axis 0 and 5.
The size is 36, which means the maximum for each row is 6 and 5 is okay then,
but it says index 5 is out of bounds for axis 0 with size 1

print(result[x_add][y])
if x_add < index:
    if int(result[x_add][y]) == -1:
        result[x_add][y] = step
        L.put([x_add],[y])

        print("hhhh")
if x_sub > 0:
    if int(result[x_sub][y]) == -1:
        result[x_sub][y] = step
        L.put([x_sub],[y])

        print("hhh")
if y_add < index:
    print("QAQ:", x, y_add, result.size)
    if int(result[x][y_add]) == -1:
        result[x][y_add] = step
        L.put([x],[y_add])

        print("hh")
if y_sub > 0:
    if int(result[x][y_sub]) == -1:
        result[x][y_sub] = step
        L.put([x],[y_sun])

        print("h")

print(result)
How to&Answers: