-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