python--三元表达式

"""三元表达式"""
#针对以下需求
def func(x,y):
if x > y :
return x
else:
return y
res=func(33,44)
print(res)

#三元表达式
#语法格式:
#条件成立的返回值 if 条件 else 条件不成立要返回的值
x=1
y=2
res = x if x > y else y
print(res)
原文地址:https://www.cnblogs.com/clairedandan/p/14151996.html