com/ /thread that you create will call downloadxkcd(and pass different range of comics to download add the following code to your threadeddownloadxkcd py program#python threadeddownloadxkcd py downloads xkcd comics using multiple threads import requestsosbs threading os makedirs('xkcd'exist_ok=truestore comics in /xkcd def downloadxkcd(startcomicendcomic) for urlnumber in range(startcomicendcomic)download the page print('downloading page res requests get('res raise_for_status( soup bs beautifulsoup(res text'html parser'find the url of the comic image comicelem soup select('#comic img'if comicelem =[]print('could not find comic image 'elsecomicurl comicelem[ get('src'download the image print('downloading image % (comicurl)res requests get('https:comicurlres raise_for_status(save the image to /xkcd imagefile open(os path join('xkcd'os path basename(comicurl))'wb'for chunk in res iter_content( )imagefile write(chunkimagefile close(todocreate and start the thread objects todowait for all threads to end after importing the modules we needwe make directory to store comics in and start defining downloadxkcd( we loop through all the numbers in the specified range and download each page we use beautiful soup to look through the html of each page and find the comic image if no comic image is found on pagewe print message otherwisewe get the url of the image and download the image finallywe save the image to the directory we created