关于上次留的练习

我写的:

import time

def isPrime(n):
    for i in range (2,int(n**0.5)):
        if n % i == 0:
            return False
    else:
        return True
t=time.clock()
strPrimes="   "
for j in range (2,10000000000):
        if isPrime(j):
            strPrimes=strPrimes+str(j)+"   "
print(strPrimes)
print("Time used:{}".format(time.clock()))
           

 

肯定大佬有更快的解决办法,编程小白求指教。

posted on 2017-04-22 10:56  X-reborn  阅读(138)  评论(1编辑  收藏  举报

导航