Add Up to the Limit

This is a classic warm-up for loops or the sum formula: add every number from 1 up to a given limit. Write summation, which takes num and returns the sum of all integers from 1 to num, inclusive. For example, for 5, the result comes from 1 + 2 + 3 + 4 + 5.

Примеры

Ввод
1
Вывод
1
Ввод
8
Вывод
36
Ввод
5
Вывод
15

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

def summation(num: int) -> int:

Теги

math
PostgreSQLv16

Aquí aparecerá el resultado de la ejecución del código

Visible tests
1
Input
1
Expected1
2
Input
8
Expected36
3
Input
5
Expected15
4
Input
100
Expected5050
5
Input
10
Expected55
6
Input
1000
Expected500500
Focus radio
Paused · SomaFM · Fluid