三元运算:
# 三元运算 name = "Python" if True else "Web" print(name) def max(x,y): return x if x>y else y Max = max(1,2) print("最大值:",Max) def max4(a,b,c,d): res1 = max(a,b) res2 = max(res1,c) res3 = max(res2,d) return res3 Max4 = max4(11,12,16,5) print("四位数最大值:",Max4)