色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

python素數判斷方法

錢斌斌2年前15瀏覽0評論

python素數判斷方法?

python素數判斷操作如下:

mport timeit from math import sqrt def isPrimes1(n): if n <= 1: return False for i in range(2, int(sqrt(n) + 1)): if n % i == 0: return False return True def isPrimes2(n): if n > 1: if n == 2: return True if n % 2 == 0: return False for x in range(3, int(sqrt(n) + 1), 2): if n % x == 0: return False return True return False print(timeit.timeit("isPrimes1(100)", setup="from chapter01 import isPrimes1", number=10000)) print(timeit.timeit("isPrimes2(100)", setup="from chapter01 import isPrimes2", number=10000))