title: Identifying elements in a tuple
body: <p>I want to see if in a tuple of three elements there are two identical elements and a zero. Here's an example:</p>
  <pre><code>Hello = (1, 1, 0)
  Hi = (1, 0, -1)
  Greetings = (0, -1, 1)
  </code></pre>
  <p><code>Hello</code> has two numbers that are the same (and numbers besides 0 will only be -1 or 1) and the other two don't.</p>
  <p>If there is a 0 and the rest is occupied by <code>n</code> (<code>n</code> can be either 1 or -1) then can I create a function that &quot;reads&quot; my tuple and sees if there is two elements equal to each other and one equal to 0?</p>
  <p>I started coding and this is what I got:</p>
  <pre><code>tab = ((1,1,0),(1,0,-1),(0,-1,1))
  
  def line(tab, l):
      if l == 1:
          return (tab[0][0],tab[0][1],tab[0][2])
      elif l == 2:
          return (tab[1][0],tab[1][1],tab[1][2])
      elif l == 3:
          return (tab[2][0],tab[2][1],tab[2][2])
      else:
          return ValueError('invalid')
  
  def identify(n):
      if line(tab, 1)[0] == n and line(tab, 1)[1] == n and line(tab, 1)[2] == 0:
          print('2nd position')
      elif line(tab, 1)[0] == n and line(tab, 1)[1] == 0 and line(tab, 1)[2] == n:
          print('1st position')
      elif line(tab, 1)[0] == 0 and line(tab, 1)[1] == n and line(tab, 1)[2] == n:
          print('0º position')
      elif line(tab, 2)[0] == n and line(tab, 2)[1] == n and line(tab, 2)[2] == 0:
          print('2nd position')
      elif line(tab, 2)[0] == n and line(tab, 2)[1] == 0 and line(tab, 2)[2] == n:
          print('1st position')
      elif line(tab, 2)[0] == 0 and line(tab, 2)[1] == n and line(tab, 2)[2] == n:
          print('0º position')
      elif line(tab, 3)[0] == n and line(tab, 3)[1] == n and line(tab, 3)[2] == 0:
          print('2nd position')
      elif line(tab, 3)[0] == n and line(tab, 3)[1] == 0 and line(tab, 3)[2] == n:
          print('1st position')
      elif line(tab, 3)[0] == 0 and line(tab, 3)[1] == n and line(tab, 3)[2] == n:
          print('0º position')
      else:
          raise ValueError('invalid')
  </code></pre>
  <p>As you can see the code is huge (but I think the fundamentals are OK) but it doesn't run. What can be the problem?</p>