Im just learning about pythons bitwise operator <<
and >>
. as far as I see, it takes the binary version of an integer and shifts it n places left or right. that would mean that saying x<<y
is equivalent to x*(2**y)
so my question is why is there an operator for this? as far as I know python doesnt like to give you more than 1 way of doing things to avoid confusion. is there a reason this operator is particularly useful or typical scenerios where its used? I know this is a pretty open ended question but when searching for this I only come across what this operator does, not why we would use it. thankyou in advance