title: Screening for duplicates in a tuple - Python
body: <p>I am trying to create a function, <code>non_duplicates()</code>, that screens for duplicates for a given tuple <code>x</code>, and returns <code>False</code> if there is a duplicate, or returns <code>True</code> if there isn't any.</p>
  
  <p>I am doing this by a <code>for</code> loop nested within another to iterate over the items twice to compare all the items with each other. I added a conditional that checks if the two items are equal, while their indices are not. </p>
  
  <p>The problem is that the code is giving an equal <code>index</code> for different items for some reason, where I made sure that the index is linked with the iteration. </p>
  
  <p>The answer for <code>non_duplicates(((0,0),(0,0)))</code> is the same as <code>non_duplicates(((0,0),(5,5)))</code>, both are giving <code>True</code> while it should not for the former.</p>
  
  <p>When I checked <code>((0,0),(0,0))</code>, the indices are <code>"0,0    0,0    0,0    0,0"</code>, while for <code>((0,0),(5,5))</code>, the indices are <code>"0,0    0,1    1,0    1,1"</code>. </p>
  
  <p>That is why the condition are not being met.</p>
  
  <pre class="lang-py prettyprint-override"><code>def non_duplicates(x):
      y = 0
      for i, j in x:
          x1 = (i,j)
          for k, l in x:
              x2 = (k,l)
              if (x1 == x2 and x.index(x1) != x.index(x2)):
                  y = y + 1
      y = y/len(x)
      if y == 0:
          answer = True
      if y &gt; 0:
          answer = False
      return answer
  </code></pre>