1# Two's Complement binary for Positive Integers:
2
3print(int('00100001', 2))
4
5'''--------------------------------------------------------------------
6
7The Operators:
8x << y
9Returns x with the bits shifted to the left by y places (and new bits
10on the right-hand-side are zeros). This is the same as multiplying x by
112**y.
12
13x >> y
14Returns x with the bits shifted to the right by y places.
15This is the same as //'ing x by 2**y.
16
17x & y
18Does a "bitwise and". Each bit of the output is 1 if the corresponding
19bit of x AND of y is 1, otherwise it's 0.
20
21x | y
22Does a "bitwise or". Each bit of the output is 0 if the corresponding
23bit of x AND of y is 0, otherwise it's 1.
24
25~ x
26Returns the complement of x - the number you get by switching each 1
27for a 0 and each 0 for a 1. This is the same as -x - 1.
28
29x ^ y
30Does a "bitwise exclusive or". Each bit of the output is the same as
31the corresponding bit in x if that bit in y is 0, and it's the
32complement of the bit in x if that bit in y is 1.'''