def relative(a, b):
 d = distance(a, b)
 longer = float(max((len(a), len(b))))
 shorter = float(min((len(a), len(b))))
 r = (((longer - d) / longer) * (shorter / longer))
 return r

def relative ( a , b ) : d = distance ( a , b ) longer = float ( max ( ( len ( a ) , len ( b ) ) ) ) shorter = float ( min ( ( len ( a ) , len ( b ) ) ) ) r = ( ( ( longer - d ) / longer ) * ( shorter / longer ) ) return r
returns the relative distance between two strings .