Built-in Operators Relational Operators The following operators compare the passed operands and generate a TRUE or FALSE value depending on whether the comparison between the operands holds. Operator Operand types Description A = B All primitiv…
一. 三元表达式 一 .三元表达式 仅应用于: 1.条件成立返回,一个值 2.条件不成立返回 ,一个值 def max2(x,y): #普通函数定义 if x > y: return x else: return y res=max2(10,11) print(res) # res=x if x > y else y #三元表达式 # print(res) #def max2(x,y): #return x if x > y else y #代码简洁,方便 #print(max2(10,…