【发布时间】:2013-12-02 00:20:25
【问题描述】:
print "Qual deve ser o tamanho do tabuleiro?"
while 1:
tamanho = input()
if 1 < tamanho < 6:
print "Que o jogo comece!"
break
else:
print "Nao posso usar isso como um tabuleiro..."
numeros = tamanho*tamanho-1
x = [range(0,tamanho)]
y = [range(0,tamanho)]
i = 0
while i < tamanho:
x[i-1] = y[:]
i = i + 1
我不断收到索引错误
IndexError: 列表赋值索引超出范围
我正在尝试制作一个以 y 为列、x 为行的矩阵。我尝试了 for 循环,while 循环......几乎所有内容,有人可以帮助我吗?
P.S.:我还在学习中,请耐心等待。
【问题讨论】:
标签: python python-2.7 matrix indexing