What's the difference between Bitwise AND, OR and Boolean AND, OR while using them in Python? (Except their syntax) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the difference between Bitwise AND, OR and Boolean AND, OR while using them in Python? (Except their syntax)

Python Bitwise and Boolean

23rd Jul 2019, 4:10 AM
Shivam Pandey
Shivam Pandey - avatar
1 Answer
+ 1
Bitwise operators perform on bites and output bites so when using bitwise and on 6 (0110) and 5 (0101) you get 4 (0100) but using logical operators you would simply get True (both 5 and 6 are not 0). Bitwise examples: AND 1111 & 1001 = 1001 0110 & 1011 = 0010 OR 1111 | 0000 = 1111 1010 | 0100 = 1110
7th Aug 2019, 12:48 PM
Qermon
Qermon - avatar