Explanation for Bitwise operator code


#1



I was wondering what does the following code mean:
0b000001 << 2 == 0b000100 (1 << 2 = 4)

More specifically on the (1 << 2 = 4) portion of the code for the left shift Bitwise operator. Thank You!


https://www.codecademy.com/courses/python-intermediate-en-KE1UJ/1/1?curriculum_id=4f89dab3d788890003000096


Replace this line with your code.


#2

Is the decimal form of the binary integer expression to the left of it.

0b1 << 2 == 0b100
  1           4

#3

Thank You! :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.