Brain Scribble
  • DataAnalysis
  • Games
  • ProjectManagement
  • PythonIdioms
  • Archives

Decoding Binary Code (int)

Date 2015-05-08 Tags python

int('11111111', 2)
255
def binary2int(s):
    sum = 0
    for i in range(len(s)):
        sum += int(s[i]) * 2**(len(s)-i-1)
    print sum
binary2int('11111111')
255

Related Posts:

  • Decoding Binary Code (ascii)
  • Backtracking - M Coloring Problem
  • All possible combinations
  • Generating n primes
  • Backtracking - Rat in a Maze
    Brain Scribble
  • Tags

    • python
    • R
    • machine-learning
    • ipython-notebook
    • stats
    • hadoop
    • scikit-learn
    • algorithm
    • docker
  • Social

    • linkedin
    • github
  • Links

    • codeeval Profile
    • hackerrank Profile
    • Tableau Profile

© 2016 Stephanie W · Powered by pelican-bootstrap3, Pelican, Bootstrap

Back to top