title: Conditionals worked aberrantly in python:
body: <p>Trying to go through some basic algorithms:</p>
  <p>Racking my head around this block of code I wrote that doesn't always work:</p>
  <pre><code>for j in range(1,n): #over range of array 
         array = np.random.randint(1,1000,n);    
         test = 0;
         if (array[j] &gt; array[1] and array[j] == array.max()):
             plot=plot+1
             test = 1;
             break
         elif (array[j] &gt; array[1]):
             test = 2;
             break
  print(array)
  print(&quot;j = &quot;,j)
  print(test)
  </code></pre>
  <p>Problem is I get outputs like this:</p>
  <pre><code>[841 744 623 804 957]
  j =  4
  1
  </code></pre>
  <p>The code is supposed to start at position <code>1</code> and count forward. If it meets an array value greater than the position at 1, should add one to plot and exit the for loop (if that array value is the maximum). If it is just greater than <code>array[1]</code>, then exit the <code>for</code> loop without incrementing plot by <code>1</code>.</p>
  <p>Cannot figure out why <code>J</code> has to iterate all the way to <code>4</code> in that particular array above, it should have stopped at <code>3</code>, incremented plot by <code>1</code> and exited the loop.</p>