Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedanswer 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 above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago