Python says
1 << 16 = 65536
What operation does << performs in Python?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is the left shift operator for Python.
A left shift operation, as the name says, move bits to the left.
Suppose you have 2 whose binary representation is 0010.
So
2<<2means to shift the bits twice to the left:0010 -> 0100 -> 1000
1000 is the binary representation for 8. Mathematically, left shifting is the same as multiplying a number by a power of 2 :
a<<b == a*2^b, but as the operation is done only by shifting, it is much faster than doing multiplications.