diff --git a/bit.py b/bit.py new file mode 100644 index 0000000000000000000000000000000000000000..91aad60fa38508c243d41feca03f1bf418d69347 --- /dev/null +++ b/bit.py @@ -0,0 +1,38 @@ +Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 +Type "copyright", "credits" or "license()" for more information. +>>> a&1 +Traceback (most recent call last): + File "<pyshell#0>", line 1, in <module> + a&1 +NameError: name 'a' is not defined +>>> a=0b1100 +>>> a&1 +0 +>>> a&15 +12 +>>> 10&15 +10 +>>> 12&15 +12 +>>> a|15 +15 +>>> a|1 +13 +>>> a^1 +13 +>>> a^16 +28 +>>> a^15 +3 +>>> 0b1100 ^ 0b1111 +3 +>>> 0b1100 & 0b 1111 +SyntaxError: invalid token +>>> 0b1100&0b1111 +12 +>>> a=255 +>>> ~a +-256 +>>> # +>>> #보수취하면 음수취하고 -1 해줌 +>>>