import time start = time.time() while True: end=time.time() if end-start >=15 : exit() print(end-start) time.sleep(1)