This file contains 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
"""Find occurrence of an item in a list using Functional, Library & Imperative approach and compare the time. | |
""" | |
import time | |
def runtime(func, *args): | |
t=time.clock() | |
func(*args) | |
s=time.clock()-t | |
return s |
This file contains 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
"""Problem 112 http://bit.ly/dSvkG8 | |
""" | |
#increasing number | |
def isInc(n): | |
s = str(n) | |
for i,x in enumerate(s): | |
if i: | |
if s[i] < s[i-1]: | |
return False | |
return True |
This file contains 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 urllib2 as u | |
import json | |
def GeoCode(address): | |
"""Returns Latitude and Longitude of the address using | |
Google Maps Gecoding API | |
""" | |
api = "http://maps.googleapis.com/maps/api/geocode/json?address=" | |
address = str(address.replace(" ","+")) | |
url = api + address + "&sensor=false" |
NewerOlder