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. · לחץ על הרץ כדי לראות את התוצא כאן.