Question: Fill in the blanks in the following program, such that it calculate the overall value of a portfolio consisting of various stocks. It uses two
Fill in the blanks in the following program, such that it calculate the overall value of a portfolio consisting of various stocks. It uses two dictionaries: one for the number of shares in the portfolio for each stock and another dictionary for the current trading price per share.
trading = "AAPL": 139.52, "MSFT": 64.4, "AMZN": 846.02, "TSLA": 248.59 portfolio = "MSFT": 36, "TSLA": 2
total = 0 for stock in portfolio: ____ += trading [ ____ ] * ____ [ ____ ]
print("Total value of portfolio is", total) # 2815.58
First blank:
Second blank:
Third blank:
Fourth blank:
options:total portfolio stock trading
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
