Sync sleep in loop



examples/async/sleep_loop_sync.py
import time

def sleep(cnt, sec):
    print(f"Start {cnt}")
    time.sleep(sec)
    print(f"End {cnt}")

def main():
    for i in range(4):
        sleep(i, 1)


start = time.monotonic()
main()
end = time.monotonic()
print(f"Elapsed {end-start}")

Start 0
End 0
Start 1
End 1
Start 2
End 2
Start 3
End 3
Elapsed 4.004362344741821