修改了一个地方,真的太棒了!
def isPrime(number):divisor = 2while divisor <= number / 2:if number % divisor == 0:return Falsedivisor += 1return Truedef printPrimeNumbers(numberOfPrimes):# 这个代码之前就没有用,作者写的目的是什么呢?NUMBER_OF_PRIMES = 50NUMBER_OF_PRIMES_PER_LINE = 10count = 0number = 2while number < numberOfPrimes:if isPrime(number):count += 1print(number, end=" ")if count % NUMBER_OF_PRIMES_PER_LINE == 0:print()number += 1def main():print("The first 50 prime numbers are")printPrimeNumbers(10000)main()