title: Make my Nested loops Works simpler (Operating Time is Higher)
body: <p>I am a learner in nested loops in python.</p>
  
  <p>Below I have written my code. I want to make my code simpler, since when I run the code it takes so much time to produce the result.</p>
  
  <p>I have a list which contains 1000 values:</p>
  
  <pre><code>Brake_index_values = [ 44990678,  44990679,  44990680,  44990681,  44990682,  44990683,
               44997076,  44990684,  44997077,  44990685,
              ...
               44960673,   8195083,   8979525, 100107546,  11089058,  43040161,
               43059162, 100100533,  10180192,  10036189]
  </code></pre>
  
  <p>I am storing the element no 1 in another list</p>
  
  <pre><code>original_top_brake_index = [Brake_index_values[0]]
  </code></pre>
  
  <p>I created a temporary list called temp and a numpy array for iteration through Loop:</p>
  
  <pre><code>temp =[]
  arr = np.arange(0,1000,1)
  </code></pre>
  
  <p>Loop operation:</p>
  
  <pre><code>for i in range(1, len(Brake_index_values)):
      if top_15_brake &lt;= 15:
          a1 = Brake_index_values[i]
          #a2 = Brake_index_values[j]
          a3 = arr[:i]
          for j in a3:
              a2 = range(Brake_index_values[j] - 30000, Brake_index_values[j] + 30000)
              if a1 in a2:
                  pass
              else:
                  temp.append(a1)
          if len(temp)== len(a3):
              original_top_brake_index.append(a1)
              top_15_brake += 1
              del temp[:]
          else:
              del temp[:]
              continue
  </code></pre>
  
  <p>I am comparing the <code>Brake_index_values[1]</code> element available between the range of 30000 before and after <code>Brake_index_values[0]</code> element, that is `range(Brake_index_values[0]-30000, Brake_index_values[0]+30000).</p>
  
  <p>If the <code>Brake_index_values[1]</code> available between the range, I should ignore that element and go for the next element <code>Brake_index_values[2]</code> and follow the same process as before for <code>Brake_index_values[0]</code> &amp; <code>Brake_index_values[1]</code></p>
  
  <p>If it is available, store the Value, in <code>original_top_brake_index</code> thorough append operation. </p>
  
  <p>In other words :</p>
  
  <p>(Lets take 3 values a,b &amp; c. I am checking whether the value b is in range between (a-30000 to a+30000). Possibility 1: If b is in between (a-30000 to a+30000) , neglect that element (Here I am storing inside a temporary list). Then the same process continues with c (next element) Possibility 2: If b is not in b/w those range put b in another list called original_top_brake_index
  (this another list is the actual result what i needed)</p>
  
  <p>The result I get:</p>
  
  <p>It is working, but it takes so much time to complete the operation and sometimes it shows MemoryError.</p>
  
  <p>I just want my code to work simpler and efficient with simple operations.</p>