title: Check if there are 2 or 3 elements with same value in a list/tuple/etc.
body: <p>I have a 5-element list and I want to know if there are 2 or 3 equal elements (or two equal and three equal). This "check" would be a part of if condition. Let's say I'm too lazy or stupid to write:</p>
  
  <pre><code>if (a==b and c==d and c==e) or .......... or .........
  </code></pre>
  
  <p>i know it might be written like this, but not exactly how:</p>
  
  <pre><code>if (a==b and (c==b and (c==e or .... 
  </code></pre>
  
  <p>How do I do it? I also know that you can write something similar to this:</p>
  
  <pre><code>if (x,y for x in [5element list] for y in [5element list] x==y, x not y: 
  </code></pre>