Python的逻辑操作有三种:and、or、not。分别对应与、或、非。
举例:

Python的逻辑操作有三种:and、or、not。分别对应与、或、非。
举例:

 

1 #coding:utf-8
2  test1 = 12
3 test2 = 0
4  print (test1 > test2) and (test1 > 14) #result = False
5  print (test1 < test2) or (test1 > -1) #result = True
6  print (not test1) #result = False
7  print (not test2) #result = True

相关文章:

  • 2021-11-13
  • 2021-12-08
  • 2021-08-11
  • 2022-02-06
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
  • 2021-08-06
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2021-08-31
  • 2021-04-30
  • 2022-12-23
  • 2021-07-16
  • 2021-10-23
相关资源
相似解决方案