Question: Task #1 in Python Assume a product review is conducted and the result is stored in a list in the form of [ score1, score2,

Task #1 in Python

Assume a product review is conducted and the result is stored in a list in the form of [ score1, score2, ]. For example, a sample review result is stored in a list as follows [ 5, 4.5, 9.5, 6.5, 4, 5.0, 4.2, 2.0, 1.0, 3.8, 0.5, 4.6].

Write a getData(n) function that reads in review n scores one by one, and returns a list.

Write a function calAverage that takes the review list as parameter and returns the average review score. If the list is empty, the average is 0.0.

Write a main function that calls the getData() function to get a list of 10 review scores, then calls the calAverage function to get the average score.

Call the main function to run the program and print out the average score.

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!