python
Functions That Accept Any Number of Arguments
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(