Typical Value
Write a function average that receives a non-empty list nums and returns the arithmetic mean: the sum of all numbers divided by how many numbers there are. The result must be a float. You can use sum() to get the sum, len() to get the number of elements, and the / operator for division.
Примеры
Ввод
[1, 2, 3]Вывод
2Ввод
[10]Вывод
10Ввод
[2, 4]Вывод
3Нужно реализовать
def average(nums: list[int]) -> float:
Теги
listsmath
Jelentkezz be a beküldési előzmények megtekintéséhez
BejelentkezésJelentkezz be az MI-mentor használatához
BejelentkezésTests12
Visible tests
Rejtett teszt 7
Rejtett teszt 8
Rejtett teszt 9
Rejtett teszt 10
Rejtett teszt 11
Rejtett teszt 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid