Question: portfolio = [ ( ' WMT ' , 1 2 , 1 1 9 . 3 3 , 1 1 9 . 9 9 )

portfolio =[('WMT',12,119.33,119.99),
('AMD',8,148.13,179.43),
('MSFT',5,130.06,141.79),
('F',10,206.39,237.65),
('FB',2,200.80,190.38),
('GE',20,158.13,179.43)]
Write Python code that takes a portfolio as a list of tuples and returns the same portfolio as a python dictionary. The keys are ticker names, and the value for each key is a list as follows:
The first item on the list is the number of shares you own,
The second item on the list is the price you paid when you bought the stocks,
The last item on the list is the current price of the stock.
[IN] part2d(portfolio)
[OUT]{'WMT': [12,119.33,119.99],
'AMD': [8,148.13,179.43],
etc}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!