其他分享
首页 > 其他分享> > 20190616——and和or使用方法

20190616——and和or使用方法

作者:互联网

 1 """ 如果有括号:先计算括号内
 2     如果没有括号:
 3     执行顺序:从前到后
 4     结果:True or ==》True
 5         True and ==》继续走
 6         False or ==》继续走
 7         False and ==》Flase
 8 """  
 9 user = 'ales'
10 pwd = '123'
11 v1 = user == 'ales' and pwd == '1233' or user == 'alex' and pwd == '1273' and user == 'alets'
12 v2 = user == 'ales' and (pwd == '1233' or user == 'alex' and pwd == '1273')
13 print(v1)
14 print(v2)

》》》》》》

False
False

 

标签:20190616,方法,ales,括号,pwd,user,使用,print,True
来源: https://www.cnblogs.com/yssshiny/p/11037285.html