def quantile(iterable, p=0.5, sort=True, a=1, b=(-1), c=0, d=1):
 s = (sorted(iterable) if (sort is True) else list(iterable))
 n = len(s)
 (f, i) = modf(((a + ((b + n) * p)) - 1))
 if (n == 0):
  raise ValueError('quantile() arg is an empty sequence')
 if (f == 0):
  return float(s[int(i)])
 if (i < 0):
  return float(s[int(i)])
 if (i >= n):
  return float(s[(-1)])
 i = int(floor(i))
 return (s[i] + ((s[(i + 1)] - s[i]) * (c + (d * f))))

def quantile ( iterable , p = 0.5 , sort = True , a = 1 , b = ( - 1 ) , c = 0 , d = 1 ) : s = ( sorted ( iterable ) if ( sort is True ) else list ( iterable ) ) n = len ( s ) ( f , i ) = modf ( ( ( a + ( ( b + n ) * p ) ) - 1 ) ) if ( n == 0 ) : raise ValueError ( 'quantile() arg is an empty sequence' ) if ( f == 0 ) : return float ( s [ int ( i ) ] ) if ( i < 0 ) : return float ( s [ int ( i ) ] ) if ( i >= n ) : return float ( s [ ( - 1 ) ] ) i = int ( floor ( i ) ) return ( s [ i ] + ( ( s [ ( i + 1 ) ] - s [ i ] ) * ( c + ( d * f ) ) ) )
returns the pth-percentile value in x .