Counting semaphore

Report a typo

Analyze the following code block and select the best option.

import time
from threading import Thread, Semaphore
from urllib.request import urlopen

control_threads = Semaphore(5)


def open_website(url):
    with control_threads:
        time.sleep(3)
        return urlopen(url)


for _ in range(20):
    t = Thread(target=open_website, args=("https://www.python.org/",))
    t.start()
Select one option from the list
___

Create a free account to access the full topic