title: Find Largest Number From Selected List Elements In Python
body: <p>I am using Python 3.2.3, and would like to find the largest number from specific elements in a list. It is also important that I retain some knowledge of which element is the largest number, but am quite flexible on how this occurs. Let me explain...</p>
  
  <p><strong>Background</strong></p>
  
  <p>I have the following list:</p>
  
  <pre><code>the_list = ['Order', '1', '5', 'Order', '2', '18', 'Order', '3', '45', 'Order', '4', '2', 'Order', '5', '8', 'Order', '6', '2', 'Order', '7', '1', 'Order', '8', '1', 'Order', '9', '1']
  </code></pre>
  
  <p>Out of every three list elements, the first two are descriptive of the data -- i.e., "Order 1", "Order 2", "Order 3" as 'Order', '1', ... 'Order', '2', ... 'Order', '3', ... all the way to "Order 9". These do not change, and provide the source or name of every third list element.</p>
  
  <p>The third of every three list elements is the information in question. In this example, the numbers are 5... 18... 45... 2... and so forth. It from this every third element that I would like to find the largest number. In this case, that largest number is 45. These numbers change all the time; they could be any whole number from 0 through 100 [inclusive].</p>
  
  <p><strong>What I Have Tried So Far</strong></p>
  
  <p>I have tried using Python's max() function in two ways. First, simply...</p>
  
  <pre><code>max(the_list)
  </code></pre>
  
  <p>... which provides "Order" as the maximum value. A bummer on my goal.</p>
  
  <p>So I decided to try making a new list, made only of every third element of the original list. Like so...</p>
  
  <pre><code>foo = (the_line[2], the_line[5], the_line[8], the_line[11], the_line[14], the_best_line[17], the_best_line[20], the_best_line[23], the_best_line[26])
  
  max(foo)
  </code></pre>
  
  <p>... which provides "8" as the largest number, the 15th list element and the 5th third list element. It's a number, but isn't the highest number of 45 [in this example].</p>
  
  <p>I have also dabbled in making a series of if-else statements, but was both unsuccessful and in the mind-set that there must be a more pythonic//elegant way. I admit that I may have quit too early on this route, and//or that I am in the wrong mind-set.</p>