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
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