import math


def percentile(arr, percent):
    """Returns `percent`th percentile of arr"""
    arr = sorted(arr)
    if not arr:
        return None
    k = (len(arr) - 1) * percent
    lower, upper = math.floor(k), math.ceil(k)
    if lower == upper:
        return arr[lower]
    return (arr[lower] * (k - lower)) + (arr[upper] * (upper - k))