-2
嗨,我想修改我的列表,所以它显示(x)在给定的坐标通过元组。Python List/Tuple
这里是我到目前为止的代码
#w=width
#h=height
#c=coordinates
new_grid = []
def coordinates(w,h,c):
'''
>>> coordinates(2, 4, (0, 1))
>>> print(new_grid)
[['(_)', '(x)'], ['(_)','(_)'], ['(_)', '(_)'], ['(_)', '(_)']]
'''
b=[]
for i in range(h):
new_grid.append(b)
for j in range(w):
c=('(_)')
b.append(c)
我不知道如何在给定的坐标执行(X),任何帮助表示赞赏 感谢。
修复您的缩进。严重缩进的Python是无稽之谈。 – khelwood
固定对不起, – Patrick