如果将3个长方体的长宽高这样看,此题何解,,,长分别为[1, 2, 3] 宽分别为[5, 3, 2] 高分别是[7, 3, 2],定义在数组L中,L = [[1, 2, 3], [5, 3, 2], [7, 3, 2]],请分别求出三个长方体的表面积。
L1 = [1,2,3]#chang
L2 = [5,3,2]#kuan
L3 = [7,3,2]#gao
i = 0
all_L = [L1,L2,L3]
for L in all_L:
c = 2*(all_L[0][i]*all_L[1][i]+all_L[1][i]*all_L[2][i]+all_L[0][i]*all_L[2][i])
i = i + 1
print (c)
L = [[1, 2, 3], [5, 3, 2], [7, 3, 2]]
for A in L:
lenth=A[0]
wight=A[1]
heigh=A[2]
print(lenth*wight*2+lenth*heigh*2+wight*heigh*2)