标签:int 数据 tin 执行 pytho += 赋值运算 div class
运算符
逻辑运算:
and 并且的意思. 左右两端的值必须都是真. 运算结果才是真
or 或者的意思. 左右两端有一个是真的. 结果就是真. 全部是假. 结果才能是假
not 非的意思. 原来是假. 现在是真. 非真即假, 非假既真
break 结束循环. 停止当前本层循环
continue 结束当前本次循环. 继续执行下一次循环
# 计算机常用的数据 # print(2**0) # 1 # print(2**1) #2 # print(2**2) # print(2**3) # print(2**4) # print(2**5) # print(2**6) # print(2**7) # print(2**8) # print(2**9) # print(2**10) # 赋值运算. # a = 10 # a += 20 # a = a + 20 # print(a) # print(not not not not not not False) # and or not同时存在. 先算括号, 然后算not, 然后算and , 最后算or # print(3>4 or 4<3 and 1==1) # False # # print(1 < 2 and 3 < 4 or 1>2 ) # T # print(2 > 1 and 3 < 4 or 4 > 5 and 2 < 1) # T # print(1 > 2 and 3 < 4 or 4 > 5 and 2 > 1 or 9 < 8) # F # print(1 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6) # print(not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6) # F # # x or y 如果x==0 那么就是y, 否则是x # print(1 or 2) # 1 # print(2 or 3) # 2 # print(0 or 3) # 3 # print(0 or 4) # 4 # print(0 or 1 or 3 or 0 or 5) # # print(1 and 2) # 2 # print(2 and 0) # 0 # print(0 and 3) # 0 # print(0 and 4) # 0 # print(0 or 4 and 3 or 7 or 9 and 6) # print(2 > 3 and 3) # false相当于0 # print(2 < 1 and 4 > 6 or 3 and 4 > 5 or 6)
标签:int 数据 tin 执行 pytho += 赋值运算 div class
原文地址:https://www.cnblogs.com/w-y-z/p/9260515.html