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
原文:https://www.cnblogs.com/yssshiny/p/11037285.html