title: Efficiently determine if two of three items in a list are the same
body: <p>What is the most efficient way to determine if exactly two elements in a list are the same? For example:</p>
  
  <pre><code>&gt;&gt;&gt; has1dup(["one", "one", "two"])
  True
  &gt;&gt;&gt; has1dup(["one", "two", "three"])
  False
  &gt;&gt;&gt; has1dup(["one", "one", "one"])
  False
  </code></pre>
  
  <p>I have successfully done this using if/else statements. However, if the list were larger, the task of writing out each possibility for a pair would become very difficult and time consuming. Is there a faster/simpler way to accomplish this?</p>
  
  <p>Here is what I have tried:</p>
  
  <pre><code>def has1dup(lst):
      if lst[0] == lst[1] and lst[1] != lst[2]:
          return True
      elif lst[1] == lst[2] and lst[2] != lst[0]:
          return True
      elif lst[0] == lst[2] and lst[2] != lst[1]:
          return True
      else:
          return False
  </code></pre>