Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Practice: Lists and Files in Python Problem: Ocean temperature (ocean_temp.csv) is the file name that will be used Problem Specification: (1)Write a function initList (inFile)

Practice: Lists and Files in Python

Problem: Ocean temperature (ocean_temp.csv) is the file name that will be used

Problem Specification:

(1)Write a function initList (inFile) that takes a file object as parameter and returns a list of values that are read in from the file.

(2)Write a function getSize (aList) that takes a list of values as parameter and returns the value count (i.e. how many numbers in the list).

(3)Write a function getHighest( aList) that takes a list of values as parameter and returns the highest value of the list. You cannot use predefined max function.

(4)Write a function getLowest (aList) that is similar to the getHighest function but returns the lowest temperature. You may use predefined min function.

(5)Write a function getAverage(aList) that is similar to the above two functions but returns the average temperature.

(6)Write a main function that does the following:

(a)Prompt the user to enter a filename, open the file to read. If file doesnt exist, ask the user to re-enter (recommend that your program allow up to three tries, however, no point deduction if your program exits on file not found error.)

(b)Now, call the initList function to get a list of temperature data.

(c)Call the getSize function to get the number count and print out the number count.

(d)Call the getHighest function to return the highest temperature of the list. Print it out.

(e)Call the getLowest function to return the lowest temperature of the list. Print it out.

(f)Call the getAverage function to return the average temperature of the list. Print it out.

(7)Call the main function to execute your program.

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

How many deals does Passman name? What kinds?

Answered: 1 week ago

Question

6. Does your speech have a clear and logical structure?

Answered: 1 week ago