Created
February 19, 2020 04:40
-
-
Save sethrh/cace03bece234e5c359f65d3021e1347 to your computer and use it in GitHub Desktop.
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
a = 55 | |
b = 99 | |
print(a) | |
print(a & b, hex(a & b), bin(a & b)) | |
print(a | b, hex(a | b), bin(a | b)) | |
print(a ^ b, hex(a ^ b), bin(a ^ b)) | |
a = 'abcdefgh'[:2] | |
x = 0x7F7F | |
def curse(chars): | |
"""Convert the input characters (length 2) to hex | |
""" | |
a, b = chars | |
a = ord(a) | |
b = ord(b) | |
# shift a left by two bytes, OR with b | |
return (a << 8) | (b & 0xFF) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment