Skip to content

Commit 1b5081e

Browse files
committed
exercise 2.4
1 parent ecf800f commit 1b5081e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Work/report.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
# report.py
22
#
33
# Exercise 2.4
4+
5+
import csv
6+
7+
def read_portfolio(filename):
8+
portfolio = []
9+
with open(filename) as f:
10+
rows = csv.reader(f)
11+
header = next(rows)
12+
for row in rows:
13+
holding = (row[0], int(row[1]), float(row[2]))
14+
portfolio.append(holding)
15+
16+
return portfolio

0 commit comments

Comments
 (0)