1、print(1 if 2>1 else 2)
2、print(1 if 25 else 4 if 5<0 else 5)
除了这种形式,还有什么办法可以让print根据条件输出,
因为条件比较多,只用if else应付不来,
还是说只能像2那样不断用if else嵌套
1、print(1 if 2>1 else 2)
2、print(1 if 25 else 4 if 5<0 else 5)
除了这种形式,还有什么办法可以让print根据条件输出,
因为条件比较多,只用if else应付不来,
还是说只能像2那样不断用if else嵌套