问答详情
源自:5-8 Python二维list

我把这个三个小列表分别当作长宽高,运行成功但是没有结果。这是出什么问题了

L = [[1, 2, 3], [5, 3, 2], [7, 3, 2]]

for i in range(0,3):

    for q in range(0,3):

        a=L[i][q]

        continue

        b=L[i][q]

        continue

        c=L[i][q]

        s=a*b*c

        print(s)


提问者:x慕杨人1437 2022-02-05 21:04

个回答

  • 送东野
    2022-03-10 20:47:10

    # coding=utf8


    L = [[1, 2, 3], [5, 3, 2], [7, 3, 2]]

    x = 0

    for a in L : 

        p = 0

        y = 0

        for b in L :

            z = y + 1

                for c in L :

                    if z<3:

                        s = L[x][y] * L[x][z] * 2

                        p = p + s

                        z+=1

                    else:

                        break

                y+=1

        x+=1

        print (p)

    这是我的,参考一下


  • x慕杨人1437
    2022-02-05 21:46:53

    我刚刚发现写的有问题,大家不要嘲笑