当前位置:网站首页>Bool type and related operators
Bool type and related operators
2022-07-17 23:22:00 【qq_ forty-two million three hundred and seven thousand five hun】
#!/usr/bin/python
# -*- coding: UTF-8 -*-
""" bool Operator Comparison operator > < >= <= == != The result is bool type Logical operators Whether two bool Value relation and or Not bool type Value :( really )True False( false ) proposition : A declarative sentence with judgment """
# Logical operators
# And : A fake is a fake and Only when both conditions are true can it be true , As long as one side is not satisfied, it is false
print(True and True)#True
print(True and False)#False# And : A fake is a fake and Only when both conditions are true can it be true , As long as one side is not satisfied, it is false
# or :or As long as one of the conditions is true, it is true
print(True or True)#True
print(True or False)#True
print(not True)# Take the opposite
#!/usr/bin/python
# -*- coding: UTF-8 -*-
""" Determine if it's a leap year The year can be divided by four , But can't be 100 to be divisible by , Can be 400 to be divisible by Ordinary year """
year = int(input(" Please enter a year :"))
result = year % 4 == 0 and year % 100 != 0 or year % 400 == 0
print(result)
# -*- coding: UTF-8 -*-
# problem : What will appear on the console
# Short-circuit logic : Logic operation , Try to put complex and time-consuming judgments behind
num = 1
# and Find out False Then we have a conclusion , Subsequent conditions are not judged
re = num > 1 and input(" Please enter :") == "a"
# or Find out True, Then there is judgment , Subsequent conditions are not judged
re = num+1 >1 or input(" Please enter :") == "a"
边栏推荐
- Proxmox VE 7.2 从CT 模板导入虚拟机
- 【C语言】模拟通讯录(数组版、动态版、链表版)
- Proxmox ve 7.2 ISO image reset PVE root password
- Application of Flink in Zhongan insurance financial business
- Introduction and Simulation of string function
- 树状数组详解
- How to realize the association between interfaces in JMeter?
- Vs2019 Community Edition Download tutorial (detailed)
- 最常见算法面试题
- Flink's diversified exploration and practice in station B
猜你喜欢

Evolution and practice of Unicom real-time computing platform

Lightly: a new generation of rust IDE

Proxmox VE 7.2 Install Grafana+Prometheus监控 pve-exporter

Application of Flink in Zhongan insurance financial business

Contact Chen Xianbao. How much can he deal with when the 60 year old man returns?

字节遭遇离职潮!

Stock market forecast, sales forecast, virus spread A time series modeling routine, all done!

Proxmox ve 7.2 converting disk formats using QEMU img

Format transformation commonly used by grafana

一个八年软件测试工程师之路
随机推荐
秒杀项目学习
基于ycbcr的图像火灾检测系统 基于matkab的GUI系统
20220714 第二组 刘世琦 学习记录
R语言基础函数assign函数
VMware Photon OS 4 Install
Next generation wireless LAN -- MIMO SDM Foundation
Mise à l'essai de l'interface d'essai du logiciel mise en oeuvre de la production automatique de rapports et intégration continue de Postman + Newman + Jenkins
Proxmox ve 7.2 esxi ova import
字符串函数的介绍及模拟实现
Proxmox VE 7.2 从CT 模板导入虚拟机
ML:机器学习可解释性之特征置换重要性之机器学习模型中哪些特征很重要?
Wireless sensor network -- hardware design of wireless sensor network
Lightly: a new generation of rust IDE
vs2019社区版下载教程(详细)
nVisual二次开发——第一章 入门介绍
目标检测--边框回归损失函数SIoU原理详解及代码实现
赛博女娲,怎么造数字人?
Shadow插件化框架设计——replugin原理(架构师进阶之旅)
[graph theory] - Convert adjacency table into adjacency matrix
Proxmox VE 7.2 使用qemu-img转换磁盘格式