Question: Check the following code: 1. The thread does not get executed; fix the code so the thread will be executed. describe what you did 2.

Check the following code: 1. The thread does not get executed; fix the code so the thread will be executed. describe what you did 2. Change the code to make the second thread starts only after the first thread is concluded 3. Change the code to let the thread takes argument the number of seconds to sleep. Screen Shot 2021-01-09 at 10.48.12 PM.png W NP 1 import threading 2 import time 3 4 def print_func(): 5 print("Thread --> started") 6 7. print("sleeping for 2 seconds") 8 time. sleep (2) 9 print("Thread --> ended") 10 11 12 t1 = threading.Thread (name="Thread no. 1", target=my_func) t2 = threading.Thread(name="Thread no. 2", target=my_func) 13
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
