Db1 = {
'Carl': [('Intel', 30, 40), ('Dell', 20, 50), ('Intel', -10, 60), ('Apple', 20, 55)],
...
Computers and Technology, 13.01.2021 21:10 queenb1416
Db1 = {
'Carl': [('Intel', 30, 40), ('Dell', 20, 50), ('Intel', -10, 60), ('Apple', 20, 55)],
'Barb': [('Intel', 20, 40), ('Intel', -10, 45), ('IBM', 40, 30), ('Intel', -10, 35)],
'Alan': [('Intel', 20, 10), ('Dell', 10, 50), ('Apple', 80, 80), ('Dell', -10, 55)],
'Dawn': [('Apple', 40, 80), ('Apple', 40, 85), ('Apple', -40, 90)]
}
db2 = {
'Hope': [('Intel', 30, 40), ('Dell', 20, 50), ('IBM', 10, 80), ('Apple', 20, 90), ('QlCom', 20, 20)],
'Carl': [('QlCom', 30, 22), ('QlCom', 20, 23), ('QlCom', -20, 25), ('QlCom', -30, 28)],
'Barb': [('Intel', 80, 42), ('Intel', -80, 45), ('Intel', 90, 28)],
'Fran': [('BrCom', 210, 62), ('BrCom', -20, 64), ('BrCom', -10, 66), ('BrCom', 10, 55)],
'Alan': [('Intel', 20, 10), ('Dell', 10, 50), ('Apple', 80, 80), ('Dell', -10, 55)],
'Gabe': [('IBM', 40, 82), ('QlCom', 80, 25), ('IBM', -20, 84), ('BrCom', 50, 65), ('QlCom', -40, 28)],
'Dawn': [('Apple', 40, 92), ('Apple', 40, 98), ('Apple', -40, 92)],
'Evan': [('Apple', 50, 92), ('Dell', 20, 50), ('Apple', -10, 95), ('Apple', 20, 95), ('Dell', -20, 90)]
}
Define the summary function, which takes as arguments a database (dict) and a dict of current stock prices. It returns a dictionary (dict or defaultdict) whose keys are client names (str) whose associated values are 2-tuples: the first index is a dictionary (dict or defaultdict) whose keys are stock names (str) and values are the number of shares (int) the client owns. The second index is the amount of money (int) the portfolio is worth (the sum of the number of shares of each stock multiplied by its current price). Assume each client starts with no shares of any stocks, and if a client owns 0 shares of a stock, the stock should not appear in the client’s dictionary. Recall positive numbers are a purchase of the stock and negative numbers a sale of the stock. E. g., if db is the database above, calling summary(db, {'IBM':65, 'Intel':60, 'Dell':55, 'Apple':70}) would return
{ 'Carl': ({'Intel': 20, 'Dell': 20, 'Apple': 20}, 3700),
'Barb': ({'IBM': 40}, 2600),
'Alan': ({'Intel': 20, 'Apple': 80}, 6800),
'Dawn': ({'Apple': 40}, 2800)
}
def summary(db: {str: [(str, int, int)]}, prices: {str: int}) -> {str: ({str: int}, int)}:
pass
Answers: 2
Computers and Technology, 22.06.2019 06:30
Exchanging which type of data uses the least bandwidth? music photographs video voice bandwidth- the amount of data that can be moved between two points in a set time period
Answers: 1
Computers and Technology, 23.06.2019 05:00
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
Computers and Technology, 23.06.2019 10:00
How do i delete my account on this because i didn't read this agreements and also i put age at xd
Answers: 1
Computers and Technology, 23.06.2019 12:00
3. when you right-click a linked spreadsheet object, what commands do you choose to activate the excel features? a. linked worksheet object > edit b. edit data > edit data c. linked spreadsheet > edit d. object > edit data
Answers: 2
Mathematics, 09.01.2020 02:31
History, 09.01.2020 02:31
Mathematics, 09.01.2020 02:31
Spanish, 09.01.2020 02:31
Social Studies, 09.01.2020 02:31
Biology, 09.01.2020 02:31
Advanced Placement (AP), 09.01.2020 02:31
Mathematics, 09.01.2020 02:31
Mathematics, 09.01.2020 02:31
Biology, 09.01.2020 02:31
Mathematics, 09.01.2020 02:31