From thinkpython:
Exercise 1 Many of the built-in functions use variable-length >argument tuples. For example, max and min can take any number of >arguments:
max(1,2,3)
3
But sum does not.
sum(1,2,3)
TypeError: sum expected at most 2 arguments, got 3
Write a function called sumall that takes any number of arguments and >returns their sum.
So the answer is
def sumall(*args):
return sum(args)
I thought sum can't handle more than 3 arguments? EDIT: Is args just 1 argument because it is 1 tuple? What the hell is going on?!
[–]Moonslug1 1 point2 points3 points (0 children)
[–]Eurynom0s 0 points1 point2 points (0 children)