将iterable放在输入提示符中

时间:2014-10-14 20:56:29

标签: python loops input arguments

我想提示一些点(N),然后根据N提示这些点的x,y坐标。

我想要这样的事情:

inp1 = int(input("enter number of points: "))
for i in range(1,inp1+1):
    inp2 = input("input x co-ord of point i: ")

当然,我在引号内,只是在输入提示中显示“i”。我已经尝试过(“提示”,我),但输入只需要1个参数。

我该如何解决这个问题?感谢

1 个答案:

答案 0 :(得分:0)

def main() :
    inp1 = int(input("enter number of points: "))
    for i in range(1,inp1+1):
        inp2 = input("input x co-ord of point "+str(i) +" : ")

main()