Typical Value
The arithmetic mean helps you quickly understand a typical value in a list, such as an average score, price, or completion time. The function average receives a non-empty list nums and returns the sum of all numbers divided by how many numbers there are. The result should be a float.
Примеры
Ввод
[1, 2, 3]Вывод
2Ввод
[10]Вывод
10Ввод
[2, 4]Вывод
3Нужно реализовать
def average(nums: list[int]) -> float:
Теги
listsmath
Prihláste sa, aby ste videli históriu odoslaní
Prihlásiť saPrihláste sa, aby ste mohli používať AI mentora
Prihlásiť saVisible tests
1
Input
[1,2,3]Expected
22
Input
[10]Expected
103
Input
[2,4]Expected
34
Input
[1,2,3,4]Expected
2.55
Input
[-2,2]Expected
06
Input
[3,2,1]Expected
2Focus radio
Paused · SomaFM · Fluid