All source code available on github
def add(*args): total = 0 for n in args: total += n return total print add(1) print add(1,4,5) print add(9,3) print add(2.9,5,3,8)
Output:
1 10 12 18.9
def add(*args): total = 0 for n in args: total += n return total print add(1) print add(1,4,5) print add(9,3) print add(2.9,5,3,8)
1 10 12 18.9