CPSC120A
Fundamentals of Computer Science I

Post-lab 22

Lists

Lists allow us to store a lot of data at once. Often the difficult part of working with lists is not the storage, but processing the data within. To demonstrate your knowledge of using lists, write a function that averages the numbers contained within the list.

Details

Write a function called compute_average(an_integer_list). This function takes a single parameter, a list of integers. Your function should return a floating point value: the arithmetic mean of the integers in the list.

Make sure your program handles all necessary cases gracefully. What additional test cases should you check?

Sample Test Cases

Function Parameters Sample Output
[1, 2, 3] 2.0
[0] 0.0

Submission

Submit your program as a .py file on the course Inquire page before class on Friday October 31st.