Python字符串数组与函数求最大值最小值平均值

模拟7个评委的评分过程,从键盘输入7个评分。然后,去掉一个最高分和一个最低分,再计算平均分。再定义一个函数,不使用max、min和sum函数,求出传入的评分表中的最大值、最小值和平均分。(数值为100以内任意七个数)

def output(numlist):
    lst = sorted([int(i) for i in numlist])[1:-1]
    total = 0
    for i in lst:
        total += i
    return lst[-1],lst[0],round(total/len(lst),1)

nums = input('please input 7 numbers: ').split()
score = output(nums)
print('最大值、最小值和平均分分别为:',score[0],score[1],score[2])