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
PostgreSQLv16

Koodin suorituksen tulos näkyy tässä

Visible tests
1
Input
[1,2,3]
Expected2
2
Input
[10]
Expected10
3
Input
[2,4]
Expected3
4
Input
[1,2,3,4]
Expected2.5
5
Input
[-2,2]
Expected0
6
Input
[3,2,1]
Expected2
Focus radio
Paused · SomaFM · Fluid