Jan-16-2025, 04:25 PM
Hello everyone,
I have an issue at running Threads code from this example https://www.youtube.com/watch?v=A_Z1lgZL...LL&index=7 at time 4.20
Here's my code, but sentence "Press enter to exit" doesn't appear and pressing enter doesn't stop the loop:
I have an issue at running Threads code from this example https://www.youtube.com/watch?v=A_Z1lgZL...LL&index=7 at time 4.20
Here's my code, but sentence "Press enter to exit" doesn't appear and pressing enter doesn't stop the loop:
import threading
import time
done = False
def worker():
counter = 0
while not done:
time.sleep(1)
counter += 1
print(counter)
threading.Thread(target=worker).start()
worker()
input("Press enter to exit")
done = True
