0

我有以下代码:

i = 0
numbers = []

while i < 6:
    print ("At the top i is %d" % i)
    numbers.append(i)

    i = i + 1
    print ("Numbers now: ", numbers)
    print ("At the bottom i is %d" % i)


print ("The numbers: ")

for num in numbers:
    print (num)

如果我导入sleep它会减慢它的速度,但是我怎样才能暂停它以便它在我想要的时候继续?

4

1 回答 1

1

只需添加input()您希望它暂停的位置。

i=0
numbers = []
while i < 6:
    print("At the top i is %d" % i)
    numbers.append(i)

    i = i + 1
    print("Numbers now: ", numbers)
    print("At the bottom i is %d" % i)
    input() # add it here for example.


print("The numbers: ")

for num in numbers:
    print(num)
于 2015-10-18T03:29:53.807 回答