Skip to content

Instantly share code, notes, and snippets.

@astronomy88
Created April 6, 2018 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astronomy88/1a86fbd5f71610e7d032c4445075bdbb to your computer and use it in GitHub Desktop.
Save astronomy88/1a86fbd5f71610e7d032c4445075bdbb to your computer and use it in GitHub Desktop.
Converting Binary to Integer
B = '1101'
I = 0
while B != '':
I = I * 2 + (ord(B[0]) - ord('0'))
B = B[1:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment