word_before = 'kitten'
word_after = 'sitting'
if len(word_before) > len(word_after):
    word_after += ' ' * (len(word_before) - len(word_after))
elif len(word_before) < len(word_after):
    word_before += ' ' * (len(word_after) - len(word_before))
operations = []
for idx, char in enumerate(word_before):
    if char != word_after[idx]:
        if char != ' ':
            operations += ['delete at ' + str(idx)]
operations += ["insert '" + word_after[idx] + "' at " + str(idx)]
print(operations)
Algorithm to compute edit set for transforming one string into another?