Code RoomBlocking I/O in sequential loop
HardPrep Room Coding #1716

Blocking I/O in sequential loop

Code reviewConcurrencySenior–Staff~30 min

Review this Python aggregator (using requests).

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 30 min
Mark a line and say what kind of problem it is.0 findings
1import requests
2 
3def fetch_balances(account_ids):
4 # account_ids: list of independent account identifiers
5 balances = {}
6 for acct in account_ids:
7 resp = requests.get(
8 f"https://api.bank.com/v1/accounts/{acct}/balance",
9 timeout=10,
10 )
11 balances[acct] = resp.json()["available"]
12 return balances
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.