使用python 3的中间值

iMa*_*ime 1 python median python-3.x python-3.4

更新

a = int(input("Give a value: "))
b = int(input("Give a value: "))
c = int(input("Give a value: "))
def middle(a, b ,c) :
    m = min(a,b,c)
    M = max(a,b,c)
    return a+b+c-m-M
Run Code Online (Sandbox Code Playgroud)

这就是即时通讯所在。它把我的数字带入了数据。我将如何显示中间的一个?对不起,我对此感到非常恐惧。在这门入门课程中,我的想法不胜枚举。@CommuSoft @Zorg @paxdiablo和其他所有人

Zor*_*org 5

像其他人提到的那样,您缺少一个冒号,但是为了简单起见:

def middle(a, b, c):
    return sorted([a, b, c])[1]
Run Code Online (Sandbox Code Playgroud)