Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need a written a python code that answers the question below thnx Section 7: File Input/output (Thursday, February 23) Exercises: Solve the following problem
i need a written a python code that answers the question below thnx
Section 7: File Input/output (Thursday, February 23) Exercises: Solve the following problem on paper and bring your sheet of paper to your section on Thursday: 1. File Processing. Write a function process data that takes as a parameter a file name. The file holds a sequence of integers and that reports each of the cumulative sums of the sequence along with the average of the numbers. For example, if the file contains the following data: your function should produce the following output: Sum of 1 8 Sum of 2 12 Sum of 3 14 Sum of 4 23 Sum of 5 30 Sum of 6 43 Sum of 7 48 Sum of 8 57 Average 7.125 Notice that the various lines of output report the sum including just the first number, then including the first two numbers, then including the first three numbers, and so on, up to the sum including a numbers. The final line of output reports the average of the sequence of numbers. Notice that this is the average of the numbers themselves, not the average of the cumulative sums. The amount of output will vary depending upon how many numbers are in the sequence. For example, if the file contains the following values: the function should produce the following output: Sum of 1 1 Sum of 2 3 Sum of 3 6 Sum of 4 10 2,5 Average
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started