2from functools
import reduce
3from operator
import mul
5from flask_babel
import gettext
8keywords = (
'min',
'max',
'avg',
'sum',
'prod')
14 parts = query.query.split()
20 args = list(map(float, parts[1:]))
32 answer = sum(args) / len(args)
36 answer = reduce(mul, args, 1)
41 return [{
'answer': str(answer)}]
48 'name': gettext(
'Statistics functions'),
49 'description': gettext(
'Compute {functions} of the arguments').format(functions=
'/'.join(keywords)),
50 'examples': [
'avg 123 548 2.04 24.2'],