discussion of flow controlwhen you imagined the execution of program as placing your finger on line of code in your program and moving to the next line or wherever it was sent by flow control statement singlethreaded program has only one finger but multithreaded program has multiple fingers each finger still moves to the next line of code as defined by the flow control statementsbut the fingers can be at different places in the programexecuting different lines of code at the same time (all of the programs in this book so far have been single threaded rather than having all of your code wait until the time sleep(function finishesyou can execute the delayed or scheduled code in separate thread using python' threading module the separate thread will pause for the time sleep calls meanwhileyour program can do other work in the original thread to make separate threadyou first need to make thread object by calling the threading thread(function enter the following code in new file and save it as threaddemo pyimport threadingtime print('start of program ' def takeanap()time sleep( print('wake up!' threadobj threading thread(target=takeanapw threadobj start(print('end of program 'at uwe define function that we want to use in new thread to create thread objectwe call threading thread(and pass it the keyword argument target=takeanap this means the function we want to call in the new thread is takeanap(notice that the keyword argument is target=takeanapnot target =takeanap(this is because you want to pass the takeanap(function itself as the argumentnot call takeanap(and pass its return value after we store the thread object created by threading thread(in threadobjwe call threadobj start( to create the new thread and start executing the target function in the new thread when this program is runthe output will look like thisstart of program end of program wake upthis can be bit confusing if print('end of program 'is the last line of the programyou might think that it should be the last thing printed the reason wake upcomes after it is that when threadobj start(is calledthe target function for threadobj is run in new thread of execution think of it as second finger appearing at the start of the takeanap(function the main keeping timescheduling tasksand launching programs