Question: # average5.py def main(): fileName = input(What file are the numbers in? ) infile = open(fileName,'r') sum = 0.0 count = 0 for line in
# average5.py def main(): fileName = input("What file are the numbers in? ") infile = open(fileName,'r') sum = 0.0 count = 0 for line in infile: sum = sum + eval(line) count = count + 1 print(" The average of the numbers is", sum / count) main() __________________________________________________
# average6.py def main(): fileName = input("What file are the numbers in? ") infile = open(fileName,'r') sum = 0.0 count = 0 line = infile.readline() while line != "": sum = sum + eval(line) count = count + 1 line = infile.readline() print(" The average of the numbers is", sum / count) main() Test all files, average5.py, average6.py a
3. With a single .txt file, revise all files with line-by-line explanation. (Using # to add comment/explanation).
One file with line-by-line explanation, followed by one running result with IDLE shell information (try to use the same testing inputs to see the differences between each .py files).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
