Average of a list · ค่าเฉลี่ยของรายการ
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.
ค่าเฉลี่ยของรายการ
คืนค่าเฉลี่ยของรายการ: ผลรวมหารด้วยจำนวนตัวเลขทั้งหมด
len(nums) บอกคุณว่ามีไอเท็มกี่ตัวในรายการ. การหารด้วย / จะให้ผลลัพธ์เป็นทศนิยมเสมอ, ดังนั้นค่าเฉลี่ยของ 1 และ 2 คือ 1.5.
Write average(nums) that returns the mean: the total divided by how many numbers there are. The list is never empty. · เขียน average(nums) ที่ คืนค่า ค่าเฉลี่ย: ผลรวมหารด้วยจำนวนเลข รายการจะไม่ว่างเปล่า
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่