Use def foo(*args).
To calculate the average, divide sum(args) by len(args).