我有这个问题---Python中的乘法表
编写代码将打印10个正整数的乘积表和10个正整数下行。提示用户输入列和行的起始值。
我试图从另一个问题,不打印像Id期望它的一些解释。我在哪里调用print语句,什么是错的迭代
row = int(raw_input("Enter the first row number: " ))
col = int(raw_input("Enter the frist column number: "))
lastRow = row + 10
lastCol = col + 10
while (row < lastRow):
print "%4d" % (col * row)
while(col < lastCol):
print "%4d" % (col * row),
col += 1
print "%4d" % (col * row)
row += 1
这里有一个二去,更好,但并不像我想得
row = int(raw_input("Enter the first row number: " ))
col = int(raw_input("Enter the frist column number: "))
lastRow = row + 10
lastCol = col + 10
x=row
y=col
while (x < lastRow):
while(y < lastCol):
y += 1
print "%4d" % (y * x)
x += 1
很抱歉的重复后,我没有知道这是不好的礼节
[Python用户输入和乘法表]的可能重复(http://stackoverflow.com/questions/7990991/python-user-input-and-multiplication-table) – agf