title: how to make if conditions work with specific string characters?
body: <p>I want to develop a program that takes input in the form of bits and outputs the decimal equivalent. </p>
  
  <p>I am restricted in the kind of functions I can use so this is what I came up with:</p>
  
  <pre><code>digits=raw_input("enter 1's and 0's")
  a=len(digits)
  repeat=a
  c=0
  total=0
  while (c &lt; repeat):
      if digits[c]==1:
          total=total + (2**a)
          c=c+1
          a=a-1
      else:
          c=c+1
          a=a-1
  print total
  </code></pre>
  
  <p>The code returns <code>0</code> for all kinds of strings I enter. </p>
  
  <p>How can I fix my <code>if</code> statement to work correctly.</p>