as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
generate a program in python to find the median of a list.
user
def median(data):
    data.sort()
    if len(data) % 2 == 0:
        n = len(data) // 2
        return (data[n-1] + data[n]) / 2
    else:
        return data[len(data) // 2]
assistant