Solution Review: Average of a List
Explore how to write a Python function that calculates the average of a list of numbers. Understand key concepts like looping through list elements, summing values, and dividing by the list length. This lesson helps you build essential programming techniques foundational to data science tasks.
We'll cover the following...
We'll cover the following...
Solution
We define the average function in lines 2-8. Let’s break this function down. For computing the average of the list, we need to find the sum of the numbers in the list and the length of the list. We already know we can use the len function to compute ...