我正在尝试使用 Python 从用户输入中创建一个数字三角形。我写了一段代码,但不确定如何在 python 中做一件事。我想将 print("Next row") 相应地更改为相应的行。我怎么做?
代码:
numstr= raw_input("please enter the height:")
rows = int( )
def triangle(rows):
for rownum in range (rows)
PrintingList = list()
print("Next row")
for iteration in range (rownum):
newValue = raw_input("Please enter the next number:")
PrintingList.append(int(newValue))
print()
我的代码有错误吗?或者有什么改进的建议吗?请告诉我..谢谢...