now that we've defined downloadxkcd()we'll create the multiple threads that each call downloadxkcd(to download different ranges of comics from the xkcd website add the following code to threadeddownloadxkcd py after the downloadxkcd(function definition#python threadeddownloadxkcd py downloads xkcd comics using multiple threads --snip-create and start the thread objects downloadthreads [ list of all the thread objects for in range( )loops timescreates threads start end if start = start there is no comic so set it to downloadthread threading thread(target=downloadxkcdargs=(startend)downloadthreads append(downloadthreaddownloadthread start(first we make an empy list downloadthreadsthe list will help us keep track of the many thread objects we'll create then we start our for loop each time through the loopwe create thread object with threading thread()append the thread object to the listand call start(to start running downloadxkcd(in the new thread since the for loop sets the variable from to at steps of will be set to on the first iteration on the second iteration on the thirdand so on since we pass args=(startendto threading thread()the two arguments passed to downloadxkcd(will be and on the first iteration and on the second iteration and on the thirdand so on as the thread object' start(method is called and the new thread begins to run the code inside downloadxkcd()the main thread will continue to the next iteration of the for loop and create the next thread step wait for all threads to end the main thread moves on as normal while the other threads we create download comics but say there' some code you don' want to run in the main thread until all the threads have completed calling thread object' join(method will block until that thread has finished by using for loop to iterate over all the thread objects in the downloadthreads listthe main thread can call the join(method on each of the other threads add the following to the bottom of your program#python threadeddownloadxkcd py downloads xkcd comics using multiple threads keeping timescheduling tasksand launching programs