title: Hamming Distance Between Two Strings In Python
body: <p>I'm new to Python and I need to find the Hamming distance between two strings: </p>
  
  <pre><code>chaine1 = 6fb17381822a6ca9b02153d031d5d3da
  
  chaine2 = a242eace2c57f7a16e8e872ed2f2287d
  </code></pre>
  
  <p>The XOR function didn't work, and my search on the web was not very successful. </p>
  
  <p>I tried to modify something I found on the web, but there's some invalid syntax...:     </p>
  
  <pre><code>assert len (chaine1) == len(chaine2)
  
  return sum(chaine1 != chaine2 for chaine1, chaine2 in zip(chaine1, chaine2))
  
  
  if __name__=="__main__":    
  chaine1 = hashlib.md5("chaine1".encode()).hexdigest()
  
  chaine2 = hashlib.md5("chaine2".encode()).hexdigest()
  print hamming_distance(chaine1, chaine2)
  </code></pre>
  
  <p>Any ideas on how I could proceed? Thanks!</p>