Skip to content

Instantly share code, notes, and snippets.

@yssharma
Created October 17, 2017 11:46
Show Gist options
  • Save yssharma/2eb3fc8742f995ad8eb05c27898d47d0 to your computer and use it in GitHub Desktop.
Save yssharma/2eb3fc8742f995ad8eb05c27898d47d0 to your computer and use it in GitHub Desktop.
Get 5 random topics for studying algorithms from geeksforgeeks
"""
For educational purposes.
Do not misuse.
"""
from random import shuffle
import urllib
f = urllib.urlopen('http://www.geeksforgeeks.org/array-data-structure/')
li = [l.split('href="')[1] for l in f.readlines() if '<li>' in l and 'http' in l]
qlist = [l.split(">")[1].split('</a')[0] + '\t' + l.split('">')[0] for l in li]
shuffle(qlist)
print '\n'.join(qlist[:5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment