This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am geoffnin on github. | |
* I am geoffnin (https://keybase.io/geoffnin) on keybase. | |
* I have a public key ASD7QH-ZsWChV69goh8L-DXUIyj_1dxtQ6Swmk7GUidkRAo | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, re | |
def find_leading_nodes(graph): | |
# get list of edges pointing to anything | |
used_keys = [v for k in graph for v in graph[k]] | |
# return a list of nodes who are not present in 'used keys' | |
return [k for k in graph if k not in used_keys] | |
def has_incoming_edges(graph, node): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os, re | |
import urllib2 | |
from bs4 import BeautifulSoup | |
euler_url = 'http://projecteuler.net/problem=' | |
def main(): | |
for problem_number in sys.argv[1:]: | |
page = urllib2.urlopen(euler_url + problem_number) | |
html = page.read() |