0
對於一個文字遊戲(類似於圖像提供的),其中在網格內各種字母輸入在不同的瓦片上,我必須創建一個6 * 6網格,然後執行操作它喜歡:Python:如何在網格上操作
a)place the tile on a specific location in the grid and
b)return the location of any tile on the grid
c)determining the top scoring words in the grid
到目前爲止我已成功地創建格,但是我不知道該怎樣放置瓦上一個特定的網格或獲取的grid.I瓷磚的位置,創造了線索以下網格:
grid = [[" _" for x in range(6)]]
for y in range(6):
list1 = []
for x in range(13):
if x%2 == 0:
list1.append("|")
else:
list1.append("_")
grid.append(list1)
for row in grid:
print("".join(row))
我是新的python和任何幫助,將不勝感激。
謝謝,我糾正了我上面提供的代碼片段,是的,它工作。然而,我無法使用您建議的方式在網格中插入元素。 –