Syntax and Usage

Now that you're familiar with file input and output, read this for more on syntax and usage.

Files

In-class activity 1

What if we want to find the sum of all numbers in a file, but the source file is formatted differently?

- the numbers are separated by a comma and by a new line

Modify the program in the file workWithFiles4.py to accommodate the new formatting.


source3.txt
1,8,9.2,-5
1.4,9,8,13
0,12,-23,-9,1
1.6,2.3,-9.1,-5
-42,-91,7,23,17