Flatten one level
Return a new list containing the items of each inner list in order. Flatten exactly one level.
rows = [[1, 2], [], [3]]
for row in rows:
print(row)Reason about the state
Use one loop for the outer sequence and one for its elements. Nested lists inside an inner list remain values. Before writing code, identify what each variable means after one iteration. Walk through the example and explain why the next transition preserves that meaning. Then check the smallest permitted input and a case with repeated values. A correct answer follows the contract for every input, including the boundary cases in the checks. Keep any input mutation within the stated rules; return a fresh result when the task asks for one.
Your task
Return a new list containing the items of each inner list in order. Flatten exactly one level.
The explanation opens here once every check passes.