Python
All Top Python Interview Questions#3
Multi-Key Sorting with Lambda Functions in Python
EasyInterview Question #3
Given a list of client dicts with `name`, `tier` (1 to 3, where 1 is highest), and `revenue`, sort the clients primarily by `tier` ascending, and secondarily by `revenue` descending.
Input Table: clients
1 rows preview| clients |
|---|
| [object Object],[object Object],[object Object] |
Expected Output Structure3 rows
| name | tier | revenue |
|---|---|---|
| Gamma Inc | 1 | 95000 |
| Acme Corp | 1 | 50000 |
| Beta LLC | 2 | 80000 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
Python 3.10 (Pandas)
Environment Ready
Starting the real Python + pandas runtime (one-time download)…