30 seconds of python

  Back to Home

average

mathlistbeginner

Returns the average of two or more numbers.

Use sum() to sum all of the args provided, divide by len(args).

def average(*args):
  return sum(args, 0.0) / len(args)