def stats_quantile(data, q):
 sx = sorted(data)
 def get_quantile(q1):
  pos = ((len(sx) - 1) * q1)
  if (abs(((pos - int(pos)) - 0.5)) < 0.1):
   return ((sx[int(pos)] + sx[(int(pos) + 1)]) * 0.5)
  else:
   return sx[int((pos + 0.5))]
 if hasattr(q, '__iter__'):
  return tuple([get_quantile(qi) for qi in q])
 else:
  return get_quantile(q)

def stats_quantile ( data , q ) : sx = sorted ( data ) def get_quantile ( q1 ) : pos = ( ( len ( sx ) - 1 ) * q1 ) if ( abs ( ( ( pos - int ( pos ) ) - 0.5 ) ) < 0.1 ) : return ( ( sx [ int ( pos ) ] + sx [ ( int ( pos ) + 1 ) ] ) * 0.5 ) else : return sx [ int ( ( pos + 0.5 ) ) ] if hasattr ( q , '__iter__' ) : return tuple ( [ get_quantile ( qi ) for qi in q ] ) else : return get_quantile ( q )
return the specified quantile(s) q of the supplied list .