Question: ` totals . txt ` was expected to be 3 lines long, but it was 4 lines long. Goal: Learn to read structured files line
totalstxt was expected to be lines long, but it was lines long.
Goal: Learn to read structured files line by line.
Assignment: A file named units.txt records the contents of the containers in a logistic hub. Each line contains the number of items, and each container section is separated from the next by a line with a dash. The following is an example file:
Contents of units.txt
Write some code that creates a file named totals.txt in which each line is the sum of all the item counts per container section. Continuing the above example, the following is the example result:
Contents of totals.txt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
