举例:if - else
def func(a,b):
if a=='amdin' and b=='pwd':
print('OK')
else:
print('No')
func('admin','c')
举例:1.三目运算
def fund(a,b):
print('OK') if a=='amdin' and b=='pwd' else print('No')
fund('amdin','pwd')
举例:2.嵌套三目运算
def funE(a,b):
print('大于') if a>b else ( print('等于') if a==b else print('小于'))//注意这里的3目多了个括号 并且表达式前是true后面是false
funE(11,12)