A Semaphore caps how many fetches run at once
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
A Semaphore caps how many fetches run at once. You have 10 fetches, each taking 1.0s of wait, and a concurrency limit of 3. They run in waves of at most 3; total time = number_of_waves * 1.0s. Compute and print the number of waves and the total seconds (1 decimal), one per line. (Model it, no asyncio.)
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.