Problem

You want to write a function that accepts any number of input arguments.

Solution

To write a function that accepts any number of positional arguments, use a * argument.
For example:

def avg(first, *rest):
 return (first + sum(rest)) / (1 + len(rest))
# Sample use
avg(1, 2) # 1.5
avg(1, 2, 3, 4) # 2.5

In this example, rest is a tuple of all the extra positional arguments passed. The code
treats it as a sequence in performing subsequent calculations.