例题

逻辑运算符:not  and    or的运用题

print(3>4 or 4<3 and 1==1)   #False
print(1 < 2 and 3 < 4 or 1>2 )   #True
print(2 > 1 and 3 < 4 or 4 > 5 and 2 < 1 )   #True
print(1 > 2 and 3 < 4 or 4 > 5 and 2 > 1 or 9 < 8  ) #False
print(1 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6  )   #False
print(not 2 > 1 and 3 < 4 or 4 > 5 and 2 > 1 and 9 > 8 or 7 < 6   )  #False
print(0 or 3 and 5 or 4)    #5

  x or y,如果x不等于0,则返回x,否则返回y。        x and y的定义于前面or的定义相反

面试题:

    ASCII最左一位都是0
      为什么都是0?
      因为当时的创造者预留的。

原文地址:https://www.cnblogs.com/yuncong/p/9415618.html