Python
#3

Multi-Key Sorting with Lambda Functions in Python

Easy
Interview 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
nametierrevenue
Gamma Inc195000
Acme Corp150000
Beta LLC280000
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)…

Chat with us