Answered step by step
Verified Expert Solution
Question
1 Approved Answer
answer all of the questions plz The following code is meant to compute the average amount of rain that fell in an area during Hurricane
answer all of the questions plz
The following code is meant to compute the average amount of rain that fell in an area during Hurricane Sandy. The data is read from a file named "rainAmounts.dat". which contains the amount of rain that fell in inches in a local area, each on its own line in the file. The data file is complete. However, the code will not execute correctly. def average(filename): rainFile - open(filename, "r") total = 0 numLines = 0 for amount in rainFile: total += eval(amount) rainFile.close() return totalumLines print("Average rain:", average("rainAmounts.dat")) What is the problem? Fix the code so that it will execute correctly to display the correct result. Give an example of a formal parameter from the program above. Give an example of an actual parameter (should be different from answer to c above). Give an example of a function call from the program above. Give an example of a method call from the program aboveStep 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