# ==============================================================================
"""STAT : perform some statistical operations on a list of numerical values"""
# ==============================================================================
__author__  = "Christophe Schlick"
__version__ = "0.0" # skeleton version
__date__    = "2015-09-01"
__usage__   = """
User input : <operator> <value> [value...]
             where operator = 'min'|'max'|'sum'|'mean'|'variance'|'deviation'
             and value:int|float
App output : apply operator on the set of values"""
# ==============================================================================
from ezCLI import *
# ------------------------------------------------------------------------------
# Note: 'min', 'max' and 'sum' are already defined as Python built-in functions
# ------------------------------------------------------------------------------
def mean(values):
  """return the arithmetic mean for a list of numerical values"""
  # TODO
# ------------------------------------------------------------------------------
def variance(values):
  """return the variance for a list of numerical values"""
  # TODO
# ------------------------------------------------------------------------------
def deviation(values):
  """return the standard deviation for a list of numerical values"""
  # TODO
# ------------------------------------------------------------------------------
def parser(command):
  """parse 'command' and apply provided operator to all values"""
  operator, values = command.split(maxsplit=1); #inspect()
  values = parse(values); #inspect()
  # check if valid name for operator
  # check if all values are numerical (int or float)
  return "%s = %s" % (command, "%s(%s)" % (operator, values))
# ==============================================================================
if __name__ == "__main__":
  userloop(parser, "Enter <operator> <value> [value...]")
# ==============================================================================
