Python, Programming, Coding, Software Development, Datastrucutre.
lock.acquire() numbers.append(n) # release the lock lock.release() # create two threads t1 = threading.Thread(target=add_number, args=(1,)) t2 = threading.Thread(target=add_number, args=(2,)) # start the threads t1.start() t2.start() # wait for the threads to finish t1.join() t2.join() # print the