Objective
Create a Python program that reads lines in CSV format and adds up one of their columns with the csv module.
Instructions
- Read an integer
nand thennlines with the formatproduct,price. - Go through the lines with
csv.reader(you can pass it the list of lines directly). - Add up the prices, which are in the second column.
- Show
Total: T, with the total to two decimals.
3
pan,1.20
leche,0.95
huevos,2.35
Total: 4.50
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise