我試圖製作一個戰列網格,左邊的數字和頂部的字母。我很困惑你將如何打印出一定數量的字母,並用python添加它們。談到Python,我是一個非常新的初學者。Python:如何打印出一定範圍的字母表
例如:
def displayGrid(Rows,Columns):
output = '| '
for title in range(97,110):
output = output + chr(title)
output = output + ' |'
print(output)
for row in range(Rows):
output = str(row + 1) + '| '
for col in range(Columns):
output = output + " | "
print(output)
Rows = int(input("Number of rows you want? \n"))
Columns = int(input("Number of columns you want? \n"))
displayGrid(Rows, Columns)
我希望它這樣的列數是它打印出的字母數,但我似乎無法弄清楚。
,我固定它。我很困惑我是多麼的無能爲力。對不起,說這個不必要的問題。 – Mvpgman1425
歡迎來到星期一。 :) – acdr