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
try: | |
import urllib.parse # Python 3 | |
except ImportError: | |
from urllib2 import urlopen # Python 2 | |
import os | |
import re | |
import tempfile | |
from contextlib import contextmanager | |
import six |
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 math | |
def distance(str): | |
li_str = list(str) | |
result = 0 | |
for i in range(1,len(li_str)): | |
row_prev = get_row(li_str[i-1]) | |
col_prev = get_col(li_str[i-1]) | |
row = get_row(li_str[i]) | |
col = get_col(li_str[i]) |