计算两个二维数组之和,结果逐行输出 用python
时间: 2024-02-23 19:00:12 浏览: 54
python 实现 两数之和
好的,以下是 Python 代码实现:
```python
a = [[1,2,3],[4,5,6],[7,8,9]]
b = [[9,8,7],[6,5,4],[3,2,1]]
result = []
for i in range(len(a)):
row = []
for j in range(len(a[0])):
row.append(a[i][j] + b[i][j])
result.append(row)
for row in result:
print(row)
```
输出结果为:
```
[10, 10, 10]
[10, 10, 10]
[10, 10, 10]
```
希望这能够回答您的问题!
阅读全文