title: Writing a loop by fixing one index and comparing to every other index of that same array
body: <p>For an array, i want to fix one index value and compare it to every other index value. e.g. Fix x[0] and if any of x[1], x[2], ..., x[n] are larger than x[0] return its index value. Then fix x[1], return any x[0], x[2], ..., x[n] that are larger than x[1] and so on.... so for each i, it should return an array. What is this called, is there a special loop for this, i cannot figure how to code it?</p>
  <pre><code>x = np.array([1,4,9,4,5,5,2])
  n = len(x) 
  for i in range(n-1):
      for j in range(n-1):
          if x[j] &gt; x[i]:
              print(x[i:j])     
  </code></pre>
  <p>This returns</p>
  <pre><code>[1 4]
  [1 4 9]
  [1 4 9 4]
  [1 4 9 4 5]
  [4]
  [4 9 4]
  [4 9 4 5]
  []
  [4]
  [4 5]
  []
  []].
  </code></pre>
  <p>But since x[0] = 1, then every value in x is bigger than this so it should return [1,2,3,4,5,6].</p>
  <p>For x[1] = 4, it should only return [2,4,5] since these are all larger.</p>