1.关于Python的三元操作符运算理解:
small = x if ( x < y and x < z) else ( y if y < z else z)
这个三元操作符可以这么理解:
small = x
if x < y and x < z:
small = x
else:
if y < z:
small = y
else:
small = z
1.关于Python的三元操作符运算理解:
small = x if ( x < y and x < z) else ( y if y < z else z)
这个三元操作符可以这么理解:
small = x
if x < y and x < z:
small = x
else:
if y < z:
small = y
else:
small = z