Add the Numbers

Adding a list is a basic operation for receipts, scores, ratings, and many kinds of numeric data. The function sum_list receives a list of numbers nums and returns the total of all its elements. If the list is empty, there is nothing to add, so the result should be 0.

Примеры

Ввод
[1, 2, 3]
Вывод
6
Ввод
[]
Вывод
0
Ввод
[10, -10]
Вывод
0

Нужно реализовать

def sum_list(nums: list[int]) -> int:

Теги

arraylistsmath
PostgreSQLv16

Čia bus kodo vykdymo rezultatas

Visible tests
1
Input
[1,2,3]
Expected6
2
Input
[]
Expected0
3
Input
[10,-10]
Expected0
4
Input
[5]
Expected5
5
Input
[1,1,1,1,1]
Expected5
6
Input
[100,200,300]
Expected600
Focus radio
Paused · SomaFM · Fluid