首页 > 其他 > 详细

关于上次留的练习

时间:2017-04-22 12:11:10      阅读:129      评论:0      收藏:0      [点我收藏+]

我写的:

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()))
           

 

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

关于上次留的练习

原文:http://www.cnblogs.com/X-reborn/p/6747164.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!