Average of a list
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
This one builds on a lesson you haven't finished yet. Do that lesson first:
Python Basics · Functions →
Average of a list
Return the mean of a list: the total divided by how many numbers there are.
len(nums) tells you how many items the list has. Dividing with / always gives a decimal, so the average of 1 and 2 is 1.5.
Difficulty 3/5 · 200 coins + a small bonus on first completion today
Write average(nums) that returns the mean: the total divided by how many numbers there are. The list is never empty.
Click Run to see the output here.