DataDrivenDataDriven
LearnPracticeInterviewDiscussDailyJobs

Closing Bell

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 brokerage export gives you `prices`, a dict keyed by ISO date string mapping to that day's close, and `purchases`, a list of `[date, quantity]` buy records where quantity is a whole number of shares. Mark every lot to the price on the latest date in the history and return the portfolio's total gain, where each buy contributes its quantity times how far the price has moved since the day it was bought.

Summary

Every share you own, priced at today's close. Tally the gains.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and checks it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons