title: Python - Math operations from parsed API data
body: <p>I have written a python script that pulls data from an API ( <a href="https://api.hypixel.net/skyblock/auctions" rel="nofollow noreferrer">https://api.hypixel.net/skyblock/auctions</a> ) and it works pretty well for what I want it to do, however, I wanted to add a feature which would find the exact same item twice, then compare the lowest 2 prices for it (subtraction) then shows me the difference between the lowest price and 2nd lowest price.
  Example:
  Item X Lowest Price: 100,000
  Item X 2nd Lowest Price: 300,000
  if the difference is =&lt; 200,000, it shows me the value with the exact difference between the item.
  Outputs: &lt;item_name&gt;, &lt;price difference between 2 lowest prices&gt;, </p>
  <p>This is the code I have right now.</p>
  <pre><code>import requests
  
  data = requests.get(&quot;https://api.hypixel.net/skyblock/auctions&quot;).json()
  auctions = data[&quot;auctions&quot;]
  items = []
  for auction in auctions:
      try:
          if auction[&quot;bin&quot;] and (str(auction[&quot;item_name&quot;]).startswith(&quot;&quot;)) and auction[&quot;category&quot;] == &quot;weapon&quot; and auction[&quot;tier&quot;] == &quot;EPIC&quot;:
              items.append([auction[&quot;item_name&quot;], auction[&quot;starting_bid&quot;], auction[&quot;tier&quot;]])
      except KeyError:
          continue
  items.sort(key=lambda x: x[1])
  for item in items:
      print(item)
  </code></pre>