Keeping Values connected when sorting results of a for loop
<p>I am having an issue keeping values associated with their counterparts during certain parts of this code. I am trying to only print out the ticket code with the lowest priority. The first issue I had was that when someone does not enter a priority it defaults to "None". So after i filtered that out I wanted to put the remaining data into a list and then grab the min priority from that list and print it along with its ticket code. </p>

<p>The data set looks like :</p>

<pre><code>ticket    ticket code                 ticket priority
100_400   100_400 ticket description        None
100_400   100_400 ticket description         5
100_400   100_400 ticket description         1
100_400   100_400 ticket description         2
100_400   100_400 ticket description         4
100_400   100_400 ticket description         3
</code></pre>

<p>So currently this is what my code looks like:</p>

<pre><code>result = set()   
for ticket in tickets:
# to get rid of the "None" priorities
    if ticket.priority != '&lt;pirority range&gt;':
        print ""
    else:
        #this is where i need help keeping the priority and the ticket.code together
        result.add(ticket.priority)

print min(result) 
print ticket.code
</code></pre>
