【发布时间】:2020-07-03 03:53:31
【问题描述】:
我正在使用 python 3, 我有一个 9 * 9 的列表或网格,左上角是 (0, 0),右下角是 (8, 8)
我只想遍历该网格上距中心 (4, 4) 4 个或更少单元格的每个项目,
并对该单元格执行操作。
这是我当前的代码(不工作)-
for row in range(9):
amount = row * 2 + 1
for col in range(9):
if amount == 0:
continue
print("Col- ", col + 4 -(row % 4), "Row- ", row)
amount -= 1
【问题讨论】:
-
添加了我当前的代码
标签: python python-3.x list arraylist