title: Efficient way to compare elements in 2 lists
body: <p>I want to compare entries in 2 lists:</p>
  
  <p>for example: </p>
  
  <pre><code>for key in keys:
          for elem in elements:
              #Find a key in common with 2 lists and write the corresponding value
              if key == elem:
                   do something
              #Iterate through elements unit the current "key" value is found.
              else:
                   pass
  </code></pre>
  
  <p>Problem with this method is that it is very slow, is there a faster way to do this?</p>
  
  <p>*Assuming <code>len(keys) &gt; len(elements)</code></p>