title: get minimum and maximum values from a 'for in' loop
body: <p>First post &amp; I've probably got no business being here, but here goes...</p>
  
  <p>How do I find the maximum and minimum values from the output of a 'for in' loop?</p>
  
  <p>I've tried the min() and max() and get the following error...</p>
  
  <pre><code>TypeError: 'int' object is not iterable
  </code></pre>
  
  <p>here's my code...</p>
  
  <pre><code>import urllib2
  import json
  
  def printResults(data):
    # Use the json module to load the string data into a dictionary
    theJSON = json.loads(data)
  
    # test bed for accessing the data
    for i in theJSON["features"]:
     t = i["properties"]["time"]
     print t
  
  def main():
    # define a variable to hold the source URL
    urlData = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson"
  
    # Open the URL and read the data
    webUrl = urllib2.urlopen(urlData)
    #print webUrl.getcode()
    if (webUrl.getcode() == 200):
      data = webUrl.read()
      # print out our customized results
      printResults(data)
    else:
      print "Received an error from server, cannot retrieve results " +  str(webUrl.getcode())
  
  if __name__ == "__main__":
     main()
  </code></pre>
  
  <p>Any pointers will be greatly appreciated!</p>