Average of a list · Trung bình của một danh sách
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.
Trung bình của một danh sách
Trả về trung bình cộng của danh sách: tổng chia cho số lượng các số.
len(nums) cho biết danh sách có bao nhiêu phần tử. Phép chia với / luôn trả về số thập phân, nên trung bình của 1 và 2 là 1.5.
Write average(nums) that returns the mean: the total divided by how many numbers there are. The list is never empty. · Viết average(nums) trả về trung bình: tổng chia cho số lượng phần tử. Danh sách sẽ không bao giờ rỗng.
Click Run to see the output here. · Nhấn Chạy để xem kết quả ở đây.