首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >python逻辑运算符

python逻辑运算符

原创
作者头像
meowrain
发布2022-06-23 18:30:15
8740
发布2022-06-23 18:30:15
举报
文章被收录于专栏:MeowRain的博客MeowRain的博客

title: python逻辑运算符

tags: 笔记

categories: 笔记

author: 喵雨

date: 2022-06-23 10:56:09

coverImg:


逻辑运算符

'''
逻辑运算符
and or not
and : 与 并且
True and True ---> True
True and False --> False
False and False --> False
False and True --> False

or  或 或者 只要一侧为真,结果即为真
True or False ---> True
True or True --> True
False or False --> False
'''
a = 1
b = 2
print(a and b)
print(b and a)  # 两边都是数字,结果是最后得数字值`

c = 0
print(a and c)  # and中只要一边为0,那么两边都为0

print(a > c and b > c)
print(a < c and b > c)
print('-' * 30)
print(a > c or b > c)
print(a > c or b < c)
print(a == c or b == c)
print('-'*30)

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 逻辑运算符
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档