Skip to content

Commit 320afe5

Browse files
committed
profit-loss output code update
1 parent a97dc4e commit 320afe5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

PyBank/profit-loss.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ def average(numbers):
88
total += number
99
return total / length
1010

11+
12+
# FINANCIAL ANALYSIS (results printed to terminal)
1113
input_path = os.path.join('.',"budget_data.csv")
12-
output_file = os.path.join('.', "financial_analysis.txt")
1314

1415
with open(input_path, newline="") as csvfile:
1516
csvreader=csv.reader(csvfile, delimiter=",")
@@ -44,7 +45,11 @@ def average(numbers):
4445
print("Greatest Increase in Profits: " + str(maxmonth) + " ($"+str(max_profit) +")")
4546
print("Greatest Decrease in Profits: " + str(minmonth) + " ($"+str(min_profit)+")")
4647

48+
49+
4750
# WRITE RESULTS TO TXT
51+
output_file = os.path.join('.', "financial_analysis.txt")
52+
4853
with open(output_file, "w", newline="") as output_file:
4954
output_file.write('.....................................................')
5055
output_file.write('\n Financial Analysis')

0 commit comments

Comments
 (0)