title: Inaccurate hamming distance of two strings in binary
body: <p>I'm trying to calculate the hamming distance between two strings in binary. However I'm not getting the expected output which is 37. Instead I get 33. Can someone explain to me the mistake I'm making?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>def to_bin(s):
  return ''.join(format(ord(x), 'b') for x in s)
  s1 = to_bin('this is a test')
  s2 = to_bin('wokka wokka!!!')
  
  def hamming_distance_bin(x,y):
      z = []
      for i,j in zip(x,y):
          z.append(ord(i)^ord(j))
      return z.count(1)
  
  
  
  print hamming_distance_bin(s1,s2)
  </code></pre>
  
  <p>The reason I'm using the list above, is so that I could print my xor'd output to manually count the 1's and see where I'm going wrong. But I don't seem to understand!</p>