Answers for "how to set a timer in while loop python"

0

how to set a timer in while loop python

start_time = time.time()
seconds = input("Enter: ")
seconds = int(seconds)

while True:
    current_time = time.time()
    elapsed_time = current_time - start_time

    if elapsed_time > seconds:
        print("Finished iterating in: " + str(int(elapsed_time))  + " seconds")
        break
Posted by: Guest on July-05-2021

Code answers related to "how to set a timer in while loop python"

Python Answers by Framework

Browse Popular Code Answers by Language