筆記
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 二進位表示 | |
print(bin(10)) | |
# 左移一個位元 = * 2 | |
print(8 << 1) | |
# 右移一個位元 = / 2 | |
print(32 >> 1) | |
# 且、或、互斥或、反(非) | |
print(8 & 10) | |
print(8 | 10) | |
""" | |
Outputs: | |
0b1010 | |
16 | |
16 | |
8 (1000 & 1010 = 1000) | |
10 (1000 | 1010 = 1010) | |
""" |
留言
張貼留言