Range Total

Imagine you need to quickly add all numbers between two marks on a number line. Write a function get_sum that takes two integers a and b in any order. Return the sum of all integers from the smaller number to the larger one, inclusive; if the numbers are equal, return that number.

Примеры

Ввод
1, 0
Вывод
1
Ввод
1, 2
Вывод
3
Ввод
0, 1
Вывод
1

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

def get_sum(a: int, b: int) -> int:

Теги

math
PostgreSQLv16

Εδώ θα εμφανιστεί το αποτέλεσμα εκτέλεσης του κώδικα

Visible tests
1
Input
1, 0
Expected1
2
Input
1, 2
Expected3
3
Input
0, 1
Expected1
4
Input
1, 1
Expected1
5
Input
-1, 0
Expected-1
6
Input
2, 2
Expected2
Focus radio
Paused · SomaFM · Fluid