Python列表显示问题
不知道如何搜索,所以决定在这里询问。 如何使输出列表垂直显示数字集??我在3.3级Python列表显示问题,python,Python,不知道如何搜索,所以决定在这里询问。 如何使输出列表垂直显示数字集??我在3.3级 ROWS = 5 COLS = 2 def main(): num1 = int(input('Type a whole number and press ENTER: ')) values = [[10, 0], [13, 0], [36, 0], [74, 0], [22, 0]]
ROWS = 5
COLS = 2
def main():
num1 = int(input('Type a whole number and press ENTER: '))
values = [[10, 0],
[13, 0],
[36, 0],
[74, 0],
[22, 0]]
for row in values:
row[1] = row[0] + num1
display(values)
def display(values):
print(values)
input('press enter to continue')
main()
您可以遍历
值的元素(即列表),并在每次迭代时打印新行:
for row in values:
print(row) # this will print a new-line after printing 'row'
您可以遍历值的元素(即列表),并在每次迭代时打印新行:
for row in values:
print(row) # this will print a new-line after printing 'row'
您可以遍历值的元素(即列表),并在每次迭代时打印新行:
for row in values:
print(row) # this will print a new-line after printing 'row'
您可以遍历值的元素(即列表),并在每次迭代时打印新行:
for row in values:
print(row) # this will print a new-line after printing 'row'
“垂直显示数字集”是什么意思?也许可以提供一个您想要的输出示例。您所说的“垂直显示数字集”是什么意思?也许可以提供一个您想要的输出示例。您所说的“垂直显示数字集”是什么意思?也许可以提供一个您想要的输出示例。您所说的“垂直显示数字集”是什么意思?也许可以提供一个您想要的输出示例。谢谢!这真的让我很困扰。或者:print(',\n'.join(str(row)表示值中的行))
谢谢!这真的让我很困扰。或者:print(',\n'.join(str(row)表示值中的行))
谢谢!这真的让我很困扰。或者:print(',\n'.join(str(row)表示值中的行))
谢谢!这真的让我很困扰。或者:print(',\n'.join(str(row)表示值中的行))