def percentile(p, arr=None):
if arr is None:<EOL><INDENT>return lambda arr: percentile(p, arr)<EOL><DEDENT>if hasattr(p, '<STR_LIT>'):<EOL><INDENT>return np.array([percentile(x, arr) for x in p])<EOL><DEDENT>if p == <NUM_LIT:0>:<EOL><INDENT>return min(arr)<EOL><DEDENT>assert <NUM_LIT:0> < p <= <NUM_LIT:100>, '<STR_LIT>'<EOL>i = (p/<NUM_LIT:100>) * len(arr)<EOL>return sorted(arr)[math.ceil(i) - <NUM_LIT:1>]<EOL>
Returns the pth percentile of the input array (the value that is at
    least as great as p% of the values in the array).

    If arr is not provided, percentile returns itself curried with p

    >>> percentile(74.9, [1, 3, 5, 9])
    5
    >>> percentile(75, [1, 3, 5, 9])
    5
    >>> percentile(75.1, [1, 3, 5, 9])
    9
    >>> f = percentile(75)
    >>> f([1, 3, 5, 9])
    5