Closing Bell
A medium Python mock interview question on DataDriven, with an AI interviewer who asks follow-up questions and a hire or no-hire decision at the end.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L6
Interview Prompt
A brokerage export gives you `prices`, a dict keyed by date with that day's close, and `purchases`, a list of `[date, quantity]` buy records. Return the portfolio's total gain if every buy is valued at the most recent close in the history.
Summary
Every share you own, priced at today's close. Tally the gains.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write and run your Python against test cases
- Answer the interviewer's follow-up questions, then get a hire or no-hire decision