import time
result = 0
start = time.time() # 返回运算前时间戳
for i in range(10000000):
result += i
end = time.time() # 返回运算后时间戳
print(result)
print(end - start)
import time
result = 0
start = time.time() # 返回运算前时间戳
for i in range(10000000):
result += i
end = time.time() # 返回运算后时间戳
print(result)
print(end - start)
本文标题:55-计算千万次加法运算时间
本文链接:https://www.haomeiwen.com/subject/lpclvftx.html
网友评论