20170420条件表达式的三元操作符x if 条件 else y

x,y = 4,5
if x < y:
small = x
else:
small = y
print(small)

#三元操作符语法:x if 条件 else y
small = x if x < y else y
print(small)
posted @ 2017-04-20 14:15  云ime  阅读(267)  评论(0编辑  收藏  举报