title: Comparing two sets of numbers
body: <p>I am trying to compare two sets for matching numbers. The once a number has been found append the username associated with the numbers to a dictionary along with the amount of numbers they have matched. My explanation is not the best but perhaps my code will show what I am trying to do.</p>
  
  <pre><code>c.execute('SELECT * FROM {} WHERE drawnumber = (%s)'.format(numbertable),
            drawnumber)
  numbers = c.fetchall()[0]
  print(numbers)
  
  numbers = set(imap(str.rstrip, numbers))
  
  print(numbers)
  
  c.execute('SELECT * FROM {} WHERE paid = (%s)'.format(table), paid)
  entries = c.fetchall()
  print(entries)
  
  results = defaultdict(list)
  
  for row in entries:
      user = row[1]
      number1 = row[2]
      number2 = row[3]
      number3 = row[4]
      number4 = row[5]
      number5 = row[6]
      pub_key = row[7]
  
      results[sum(n in numbers for n in row)].append(user)
  </code></pre>
  
  <p>FYI: the set numbers looks like so: <code>set(['11', '12', '15', '1', '3', '8'])</code></p>
  
  <p>The entries set looks something like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>((9L, 'test8', 12L, 4L, 3L, 15L, 8L, '1Bu1hXvk7NzoCgRFyXcGwFULtdSRsDNoCy', 'T'),
   (10L, 'test9', 12L, 4L, 1L, 15L, 8L, '1Bu1hXvk7NzoCgRFyXcGwFULtdSRsDNoCy', 'T'))
  </code></pre>