Created
September 18, 2021 15:58
-
-
Save TheBlackPlague/0de279dc912774488e83c022af6e63d0 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
binary = '101111000011010101100000'; | |
bin_len = len(binary) | |
x = 0; | |
i = 0 | |
while i < bin_len: | |
x += int(binary[i]) * 2 ** (bin_len - i - 1) | |
i = i + 1 | |
print(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment