hdarwin

cstutoringcenter.com_The Birthday Paradox

Jan 6th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import urllib, urllib2, time
  2. session = ""
  3. for x in xrange(1,1000):
  4.     input = {"id":"3","answer":"%0.3f"%(x/1000.0)}
  5.     input = urllib.urlencode(input)
  6.     print input
  7.     req = urllib2.Request("http://www.cstutoringcenter.com/problems/answer.php", input)
  8.     req.add_header("Cookie", "PHPSESSID="+session)
  9.     time.sleep(2)
  10.     if urllib2.urlopen(req).read().find("WRONG")== -1:
  11.         print 'GOOOOOOOOOOOOOD : ' + str(x)
  12.         break
Advertisement
Add Comment
Please, Sign In to add comment