Python 如何实现average和middle function

img

题主要的代码如下,有帮助麻烦点个采纳【本回答右上角】,谢谢~~

img


def average(a,b,c):
    return sum([a,b,c])/3
def middle(a,b,c):
    list=[a,b,c]
    list.sort()
    return list[1]
a=input('Please input the 1st number:')
b=input('Please input the 2st number:')
c=input('Please input the 3st number:')

if not(a.isdecimal() and b.isdecimal() and c.isdecimal()):
    prit('Invalid inputs!')
    exit()
a=int(a)
b=int(b)
c=int(c)
print(average(a,b,c))
print(middle(a,b,c))