import time t0 = time.time() code_block t1 = time.time() total = t1-t0
import time start = time.time() print("hello") end = time.time() print(end - start)
import timeit import_module = "import random" testcode = ''' def test(): return random.randint(10, 100) ''' print(timeit.repeat(stmt=testcode, setup=import_module))
import time timer_length = float(input("How many seconds would you like you're timer to be set for? ")) time.sleep(timer_length) print("Done!")
from timer import Timer t = Timer() t.start() # Run stuff here. t.stop()