Python附加多个输入的结果,并将它们作为单个输出一起打印

Python附加多个输入的结果,并将它们作为单个输出一起打印,python,Python,这是一个示例代码,一次接受2个输入,并在输入每个输入后给出结果 我得到的结果是: n=int(input("Enter no. of divisions:")) for i in range(n): (x, y) = map(int,input().split()) m=x/y print(m) 但我需要输出作为 Enter no. of divisions:3 6 3 2.0 8 4 2.0 15 3 5.0 我需要所有结果一起打印。如何附加结果?plz help您

这是一个示例代码,一次接受2个输入,并在输入每个输入后给出结果

我得到的结果是:

n=int(input("Enter no. of divisions:"))
for i in range(n):
    (x, y) = map(int,input().split())
    m=x/y
    print(m)
但我需要输出作为

Enter no. of divisions:3
6 3
2.0
8 4
2.0
15 3
5.0

我需要所有结果一起打印。如何附加结果?plz help

您可以执行两个循环,将结果保存在第一个循环中:

Enter no. of divisions:3
6 3
8 4
15 3
2.0
2.0
5.0

你能指定输入吗?
n = int(input("Enter no. of divisions:"))
results = []
for i in range(n):
    (x,y) = map(int,input().split())
    results.append(x/y)
for result in results:
    print(result)