Snatch any course you want for just $15! Go to “Courses” and find a course ↓
Introduction
Final Quiz
6. Question 5
Summary

Instruction

Great work! Two more exercises to go.

Exercise

Read the earnings_spendings.csv file. It contains the monthly earnings and expenditures of a certain family:

monthearnedspent
2018-0146403342
2018-0249194664
...

Note that the file uses the excel-tab dialect. Your task is to create a new file named home_budget.csv. Inside, provide the difference between the money earned and spent for each month:

2018-01,1298
2018-02,255
...

At the end of the file, add another line with the total yearly balance:

...
TOTAL,{amount}

Do not add a header to the output file.

Stuck? Here's a hint!

You will need to first open the file for reading, and then open another file for writing. You will also need to define two auxiliary variables: budget_results = [] and budget_total = 0.