当前位置:网站首页>实例051:按位与
实例051:按位与
2022-08-10 22:20:00 【懒笑翻】
题目:学习使用按位与 & 。
程序分析:0&0=0; 0&1=0; 1&0=0; 1&1=1。
# 只有对应的两个二进位均为1时,结果位才为1 ,否则为0。
代码:
a = 0o77
print(a)
b = a & 3
print(b)
b = b & 7
print(b)
程序运行结果:
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓懒笑翻诚邀您点击下方群聊一起来学习讨论↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
边栏推荐
- pytorch手撕CNN
- Translating scientific and technological papers, how to translate from Russian to Chinese
- LeetCode Daily 2 Questions 01: Reverse Strings (both 1200) Method: Double Pointer
- Why general company will say "go back messages such as" after the end of the interview, rather than just tell the interviewer the result?
- LeetCode Daily 2 Questions 02: Reverse the words in a string (1200 each)
- 阿里云张新涛:支持沉浸式体验应用快速落地,阿里云云XR平台发布
- JS use regular expressions in g model and non g difference
- How many threads does LabVIEW allocate?
- 【软件测试】2022年最火的十大测试工具,你掌握了几个
- 爬虫request.get()出现错误
猜你喜欢
BM13判断一个链表是否为回文结构
GMT,UTC,CST,DST,RTC,NTP,SNTP,NITZ: 嵌入式的时间
virtual address space
12 Recurrent Neural Network RNN2 of Deep Learning
电力系统潮流计算(牛顿-拉夫逊法、高斯-赛德尔法、快速解耦法)(Matlab代码实现)
Addition of linked lists (2)
An article to teach you a quick start and basic explanation of Pytest, be sure to read
罗克韦尔AB PLC RSLogix5000中计数器指令使用方法介绍
2021IDEA创建web工程
自学软件测试不知道该如何学起,【软件测试技能图谱|自学测试路线图】
随机推荐
Black cat takes you to learn Makefile Part 12: Summary of common Makefile problems
爬虫request.get()出现错误
从斐波那契 - 谈及动态规划 - 优化
port forwarding
LeetCode Daily 2 Questions 01: Reverse Strings (both 1200) Method: Double Pointer
企业云存储日常运行维护实践经验分享
高数_复习_第5章:多元函数微分学
电力系统潮流计算(牛顿-拉夫逊法、高斯-赛德尔法、快速解耦法)(Matlab代码实现)
An article to teach you a quick start and basic explanation of Pytest, be sure to read
OneNote 教程,如何在 OneNote 中整理笔记本?
OneNote tutorial, how to organize notebooks in OneNote?
H3C S5130 IRF做堆叠
Detailed installation steps and environment configuration of geemap
测试4年感觉和1、2年时没什么不同?这和应届生有什么区别?
Why general company will say "go back messages such as" after the end of the interview, rather than just tell the interviewer the result?
String类的常用方法
合并k个已排序的链表
基于交流潮流的电力系统多元件N-k故障模型研究(Matlab代码实现)【电力系统故障】
Power system power flow calculation (Newton-Raphson method, Gauss-Seidel method, fast decoupling method) (Matlab code implementation)
高通平台开发系列讲解(应用篇)QCMAP应用框架介绍