Question: In Python: An unknown number of integers are to be read from the file exam.dat. Calculate and output their sum. Next output, one entry per
An unknown number of integers are to be read from the file exam.dat. Calculate and output their sum. Next output, one entry per line, each number and its percentage of the sum. Line these up in columns. The first column should be 11 characters wide; the second column should be 7 characters wide, not including the percent sign. The percentages should berounded to the nearest tenth. See sample output below. You may assume the input data is error-free and need not be checked for correctness. The input data file is to be read only once; you are NOT allowed to open the input file a second time NOR in some way rewind the input file. Output is to standard output.
Sum Equals: 200
45 22.5%
5 2.5%
30 15.0%
20 10.0%
100 50.0%
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
