Skip to content

Instantly share code, notes, and snippets.

@peterarnott
Created August 27, 2012 10:36
Show Gist options
  • Save peterarnott/3487325 to your computer and use it in GitHub Desktop.
Save peterarnott/3487325 to your computer and use it in GitHub Desktop.
My solution to the week5 challenge
#peterarenot
import requests; i = open("input.txt"); o = open("output.txt", 'w'); d = {}
for l in i.readlines(): d[l] = float(requests.get("http://finance.yahoo.com/d/quotes.csv", params={'s': l, 'f': 'j1'}).text[:-3])
for k in sorted(d, key=d.get, reverse=True): o.write("%s - %sB\n" % (k.strip(), d[k]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment