Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4d87202

Browse files
committed
Exercise 1.33
1 parent 60dc6a5 commit 4d87202

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Work/pcost.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# pcost.py
22
#
3-
# Exercise 1.32
3+
# Exercise 1.33
44

5+
import sys
56
import csv
67

78
def portfolio_cost(filename):
@@ -23,6 +24,11 @@ def portfolio_cost(filename):
2324
f.close()
2425
return total_cost
2526

26-
cost = portfolio_cost('Data/portfolio.csv')
27+
if len(sys.argv) == 2:
28+
filename = sys.argv[1]
29+
else:
30+
filename = 'Data/portfolio.csv'
31+
32+
cost = portfolio_cost(filename)
2733
print('Total cost:', cost)
2834

0 commit comments

Comments
 (0)