求三个元素的最大值,和最小值。

a = 5
b = 6
c = 1
def max_num():
    re = (a if a>b else b)if(a if a>b else b)>c else c 
    rt = (a if a<b else b)if(a if a<b else b)<c else c
    return re,rt
l = max_num()
print(l)

 

posted @ 2020-07-21 16:21  kaiyaoweixiao  阅读(234)  评论(0编辑  收藏  举报