无法阻止程序 - Python

时间:2018-01-28 12:26:31

标签: python

import time

number = int(input("Enter a number : "))

def printer(number):
    a = 0
    while a <= number:
        print("This works!!! \n Great!!!")
        a += 1
        if a == number/2:
            check = int(input("Enter a prime number to stop this printing : "))
            count = 2
            x = 0
            while count < check:
                    if check % count == 0:
                        x += 1 
                        count += 1
            if x == 0:
                break

        time.sleep(0.5)

printer(number)

此程序不会在第11行结束。我必须通过按Ctrl + C手动停止它。我是Python的新手,请帮助我。

0 个答案:

没有答案