import time #导入time module
def test():
sum=0
for i in range(0,99999):
sum+=i
return sum
t1=time.monotonic()
print(test()) #运行函数
t2=time.monotonic()
def test():
sum=0
for i in range(0,99999):
sum+=i
return sum
t1=time.monotonic()
print(test()) #运行函数
t2=time.monotonic()
print("运行时间:",t2-t1)#计算程序运行所需要时间,单位为秒,和java有点区别