import math


def calculate_percentile_value(percentile, list):
    """Returns percentile value of list
    It uses the nearest-rank method to calculate percentile value
    given a percentile and a list.
    Example: list = [15,20,35,40,50], percentile= 30
    It returns:
    """
    #List needs to be sorted
    list = sorted(list)
    n = len(list)
    ordinal_rank = math.ceil((percentile/100) * n)

    return list[int(ordinal_rank)-1]