Arbitrary number of arguments `*`


The values arrive as tuple.

examples/functions/mysum.py
def mysum(*numbers):
    print(numbers)
    print(type(numbers))
    total = 0
    for s in numbers:
        total += s
    return total

examples/functions/use_mysum.py
from mysum import mysum

print(mysum())
print(mysum(1))
print(mysum(1, 2))
print(mysum(1, 1, 1))

()
<class 'tuple'>
0
(1,)
<class 'tuple'>
1
(1, 2)
<class 'tuple'>
3
(1, 1, 1)
<class 'tuple'>
3
(2, 3, 5, 6)
<class 'tuple'>
16