Date: Tuesday, October 24, 2023.
Due Date: Tuesday, October 31, 2023.
Goal: to use lists in Python.
Make a copy of the file lab8.1.py and call it lab8.2.py.
a. Rename the function sumList as meanList and modify it so that it finds the average of the list. The average is the sum divided by the size (len) of the list. Make sure that the function doesn't give you an error when it is called on an empty list.
The function should also return the result and not print it. If the list is empty, the function should return 0.
Test the function in the console to see if it works.
b. Rename the function searchList as countVal and modify it so that it returns the number of times the value can be found in the list. If the list is empty or does not contain the value, it should return 0.
Test this second function a few times the same way as the first one.
c. Modify the testing part, including the printed messages, to reflect the new functions.
Test the program to make sure that it works fine.
d. Add a function main with no parameters that contains all the testing code. Add a conditional at the end (outside of any function) testing if the variable __name__ contains the value '__main__', and if that's the case, make a call to the function main.
Upload the file lab8.2.py in Canvas, Assignments, Homework 8. You can wait until you finish the homework to upload all the files at the same time.