Question: input file/output help - - Coding Problem 4.4.2 (External resource) (30 points possible) Averaging.py Submit Ru Grades Reset 1 #write a function called average average

input file/output help - - Coding Problem 4.4.2 (External resource) (30 pointsinput file/output help

- - Coding Problem 4.4.2 (External resource) (30 points possible) Averaging.py Submit Ru Grades Reset 1 #write a function called average average file should Console output will be displayed here 2 #have one e Paremeter: filenam.ale. 4 #The file should have an integer on each line. average file 5 #should return the average of these intege However, if 6 #any of the lines of thefile are not integers 7 #average file should return the string "Error reading file! 8# 9 #Remember, by default, every time you read a line from 10 #file, it's interpreted as a string 12 13 #Add your function here! 14 15 17 #aelow are some lines of code that will test your function 18 #You can change the value of the variable(s) to test your 19 #function with different inputs 20 21 #if-yourfunction works correctly, this will originally 22 #print: 5.8, then Error reading file! 23 # 24 #You can select valid file.txt and invalid file.txt from 25 #the dropdown in the top left to preview their contents 26 print (everagefile velid file.txt)) 27 print (everage file( invalid file.txt)) 28 29

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!