Page 1 of 1

2. The average of a list Write Python code to do the following tasks: Task 1: Define a function named getAverage to tak

Posted: Sat May 14, 2022 4:21 pm
by answerhappygod
2. The average of a list
Write Python code to do the following tasks:
Task 1: Define a function named getAverage to take a list as input
and return the
average of the elements in this list.
Task 2: Define a function named getSmallerCount to take a list and
the average of
this list as inputs. This function returns how many elements in
this list are smaller
than the average.
Task 3: In the main program, use a for loop to input 8 integers
from the keyboard,
and store them in a list.
Task 4: Call the getAverage function to get the average of this
list. Then call the
getSmallerCount function to obtain and output how many integers in
this list are
smaller than the average of this list.
In Python code please