0

What is the practical use of bitwise operator or operations in python?

I don't get it what is the use of converting integers to binary code and operate them? I mean give example where they are usefull

9th Oct 2020, 4:41 PM
VINIT SHARMA
VINIT SHARMA - avatar
6 Respuestas
+ 2
For example i&1 returns whether i is odd or even and is much more faster than i%2, which does the same and is more often used. -(~i)) adds 1 to 1 In generall they are one of the most fastest operations one can do and almost every other operation you want to do can be done with them if you also use bitwise shifting! https://en.m.wikipedia.org/wiki/Bitwise_operation
9th Oct 2020, 5:00 PM
Alexander Thiem
Alexander Thiem - avatar
+ 4
https://www.sololearn.com/post/23827/?ref=app
9th Oct 2020, 4:48 PM
Simba
Simba - avatar
+ 2
Thank you Akbar and Simba
9th Oct 2020, 4:57 PM
VINIT SHARMA
VINIT SHARMA - avatar
+ 1
They are called "bitwise" operators. So if u need more information about individual bits with in a value then probably they are suitable.
10th Oct 2020, 8:23 PM
Kirabo Ibrahim
Kirabo Ibrahim - avatar
0
Thank you Alexander Thiem very helpful! It's all clear now!
9th Oct 2020, 7:20 PM
VINIT SHARMA
VINIT SHARMA - avatar
0
you are welcome! Then you could also add a solved tag in your question....
9th Oct 2020, 7:38 PM
Alexander Thiem
Alexander Thiem - avatar