Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dd9533 commit 596e851Copy full SHA for 596e851
Work/report.py
@@ -4,12 +4,13 @@
4
def read_portfolio(portfolio_file):
5
"""
6
:param portfolio_file:
7
- :return: list of tuples for stock portfolio read from file given
+ :return: list of dicts for stock portfolio read from file given
8
9
portfolio_list = []
10
with open(portfolio_file) as file:
11
rows = csv.reader(file)
12
headers = next(rows)
13
for row in rows:
14
- portfolio_list.append((row[0], int(row[1]), float(row[2])))
+ dict_holder = {"name": row[0], "shares": int(row[1]), "price": float(row[2])}
15
+ portfolio_list.append(dict_holder)
16
return portfolio_list
0 commit comments