All problems

Holders of One Account Type

easyPythonFiltering

Northline Bank's support team rolls out each new feature to one account type at a time and needs the list of eligible customers for whichever type is going live. The type is typed in by the person running the rollout, and it is sometimes an account type the bank has approved but nobody holds yet — in which case the list has to come back empty rather than fall over.

Customers

id name account_type city
1 Farah Idris checking Chicago
2 Grant Boyle savings Miami
3 Hana Suzuki checking Chicago
4 Ibrahim Njoku savings Miami
5 Jade Wu checking Seattle

Input

The DataFrame above is already built for you — the customer rows are not read from input. What does arrive is a single line holding the account type going live, spelled exactly as the account_type column spells it.

Task: Print a sorted Python list of names of customers whose account_type equals the line that arrived. If nobody holds that type, print an empty list.

Example: if two customers were eligible, you'd print ['Ada Bloom', 'Zeno Marsh'].

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…