python 矩形乘法

取近似值

http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a

1)通过list(map(int,iterable))将矩阵以二维列表的形式导入。这里必须在map()外面加层list()
2)通过两层for循环遍历计算两个举证相乘。

a_x,a_y,c_y = int(input()),int(input()),int(input())
a1=[]
a2 = []

for i in range(a_x):
    a1.append(list(map(int,input().split(' '))))
for i in range(a_y):
    a2.append(list(map(int,input().split(' '))))


b_list = []
for  a in range(a_x):
    x_list = []
    for c in range(c_y):
        x = a1[a][0]*a2[0][c]+a1[a][1]*a2[1][c]+a1[a][2]*a2[2][c]
        x_list.append(x)
    b_list.append(x_list)

for m in b_list:
    for n in m:
        print(n,end=' ')
    print()
全部评论

相关推荐

人力小鱼姐:实习经历没有什么含金量,咖啡店员迎宾这种就别写了,其他两段包装一下 想找人力相关的话,总结一下个人优势,结合校园经历里有相关性的部分,加一段自我评价
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-09 12:02
ssob上原来真有BOSS啊
硫蛋蛋:这种也是打工的,只不是是给写字楼房东打工
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务