<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def percentile(sorted_values, p):
 """Calculate the percentile using the nearest rank method. 35 20 Traceback (most recent call last):
 ValueError: Too few data points (0) for 90th percentile """

    size = len(sorted_values)
    idx = (p / 100.0) * size - 0.5
    if idx < 0 or idx > size:
        raise ValueError('Too few data points ({}) for {}th percentile'.format(size, p))
    return sorted_values[int(idx)]