Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

Students also viewed these Databases questions

Question

Presentation Aids Practicing Your Speech?

Answered: 1 week ago