score=[ [58,80,74,90,45,82], [71,70,64,85,50,86], [87,63,65,84,62,83], [91,66,67,92,65,90], [83,74,81,82,57,82]] k=0 while k<5: subavg=0 a=0 while a<6: subavg=subavg+score[k][a] a=a+1 subavg =subavg/6 print(subavg) k=k+1 print("***************8") rows, cols = (5, 6) s6grade=[['0'] * cols] * rows # 赋值为零 #[[]] # '''''' for i in range(0,5): for j in range(0,6): s6grade[i][j]=suc(score[i][j]) print(s6grade[i][j], end=" ") print() print('**********') for i in range(0,5): col=[] for j in range(0,6): col.append(suc(score[i][j])) #s6grade[i][j] =suc(score[i][j]) # 出问题 s6grade.insert(i,col) #print(s6grade) #print(suc(score[0][4])) # 0,4 45
score=[ [58,80,74,90,45,82], [71,70,64,85,50,86], [87,63,65,84,62,83], [91,66,67,92,65,90], [83,74,81,82,57,82]] k=0 while k<5: subavg=0 a=0 while a<6: subavg=subavg+score[k][a] a=a+1 subavg =subavg/6 print(subavg) k=k+1 print("***************8") rows, cols = (5, 6) s6grade=[[]] #[['0'] * cols] * rows # 赋值为零 ''' for i in range(0,5): for j in range(0,6): s6grade[i][j]='1' print(s6grade[i][j], end=" ") print() ''' for ii in range(0,5): col=[] for ji in range(0,6): d=suc(score[ii][ji]) col.append(d) #print(d) #s6grade[ii][ji] = d print(col) s6grade.insert(ii,col) print(s6grade) #print(suc(score[0][4])) # 0,4 45 for i in range(0,5): for j in range(0,6): print(s6grade[i][j],end=" ") print()
标签:Python,2d,62,74,65,90,82,83,arry From: https://www.cnblogs.com/geovindu/p/18239583