Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Writing CSV files
Summary

Instruction

Alright! It's time for practice!

Exercise

A fundraising event was organized in a few small towns in England. The fundraising.csv file contains a list of all contributions:

town,amount
Louth,35
Ramsgate,35
...

Your task is to analyze the file and create a file named fundraising_summary.csv that will show the total sum raised in each town:

Louth,258
Ramsgate,541
...

Stuck? Here's a hint!

Create an empty dictionary named funds_towns. Next, read the input file. For each row, check if row['town'] is a key present in funds_town. If it is, add row['amount'] to that key. If it is not, create the key and assign an initial value of row['amount'] to it.