The Column Shuffle
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant feedback.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L6
Problem
A long-format metrics export gives you one record per reading, each carrying an `id` and a single `amount`, and the same `id` can recur across many records. For each id, spread its amounts across numbered keys `amount_1`, `amount_2`, and so on in the order they appear, and return one dict per id (its `id` plus those keys) with ids in first-appearance order.
Summary
Rows in, columns out. Number them.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and checks it automatically.