所以我的代码在这里:
import time
from random import uniform
rng = uniform(1, 3)
start = time.time()
while True:
if time.time() == start + rng:
print("finally")
我的问题是:如何“最终”打印程序?
答案 0 :(得分:0)
也加上休息;)
import time
from random import uniform
rng = uniform(1, 3)
start = time.time()
while True:
if time.time() >= start + rng: # first edit here (also as suggested by Patrick Haugh)
print("finally")
break # add this also to skip infinite looping