A per-request timeout of 2.0 seconds cancels any fetch that takes longer
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
A per-request timeout of 2.0 seconds cancels any fetch that takes longer. Given fetch durations {'a':1.2,'b':3.5,'c':2.0,'d':0.4,'e':5.0}, return the names of fetches that COMPLETE within the timeout (duration <= 2.0), sorted alphabetically. Print the list. (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.