Compare string, count diffs, look for substrings else return count of diffs solution in Clear category for String Conversion by kkkkk
def steps_to_convert(line1, line2):
diffs = [i for i, (c1, c2) in enumerate(zip(line1, line2)) if c1 != c2]
if not diffs or line1 in line2:
# Either the lines are the same or one line is a subset of the other.
# If the lengths are different, then the steps needed to insert or
# delete letters is the lengths difference.
return abs(len(line1) - len(line2))
Feb. 28, 2017