Bitwise Operators in Python

Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python

Program 1

#Bitwise & AND

#a=-5&12
#print(a)

#Bitwise | OR

#a=23|7
#print(a)

#Bitwise ^  Xor

#a=12^4
#print(a)
#a=((9&5)| 6)^13
#print(a)

#a=4<<3
#print(a)

#a=13>>2
#print(a)

#a=-1>>23

#print(a)

a=~5
print(a)

a=~-12
print(a)

 

If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

courses
Image

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *