The values are first converted into binary form, then operations are done, after that the result is converted back to decimal form and the result is displayed. So, it can be a little tricky to understand these operators, but with practice, anything can be understood. [ In python, if you want to see binary equivalent of an integer (say 45), use command bin(45) . But, if you want to see binary equivalent of 'blogger' use command map ( bin , bytearray ('blogger' )) ] Bitwise operators in Python are: & (binary and): observe and understand: a= 00010010 b= 10101010 then, a&b= 00000010 In your IDLE or wherever you type in your python commands try 15&12, 60&12, 13&15. [NOTE THAT: Python displays answers by converting it back to decimal form.] | (binary or): Also known as inclusive or. a= 0001 ...





Comments
Post a Comment