Python ProgrammingPython Programming

Find the position of difference between two strings

def dif(a, b):
    return [i for i in range(len(a)) if a[i] != b[i]]

print(dif('stackoverflow', 'stacklavaflow'))
Output
[5, 6, 7, 8]