Skip to content

Sum of All Arguments

Write a function that finds the sum of all its arguments.

Example

sum_of_all_arguments(1, 2, 3) # => 6
sum_of_all_arguments(8, 2) # => 10
sum_of_all_arguments(1, 2, 3, 4, 5) # => 15

Solution

py
def sum_of_all_arguments(*args):
    return sum(args)


print(sum_of_all_arguments(1, 2, 3, 4, 5, 6))

my thoughts are neither my employer's nor my wife's