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
1 结果是值: 2 算数运算 3 a=10*10 4 赋值运算 5 a=a+1 a+=1 6 7 结果是布尔值 8 比较运算 9 a=1>5 10 逻辑运算 11 a=1>6 or 1==1 12 成员运算 13 a=“稳” in “证件问”
python数据类型详见转载文章:
https://www.cnblogs.com/wupeiqi/articles/5444685.html#top