假设我有两个长度相等的字符串:
s1 = 'tommy'
s2 = 'tammi'
我将如何编写一个返回不匹配索引的函数,如下所示:
s1 = 'tommy'
s2 = 'tammi'
mismatch = Get_Misalignment_Index(s1, s2)
print(mismatch)
[1, 4]
但也可以处理丢失或插入的字符:
s3 = 'drain'
s4 = 'rains'
gaps = Get_Misalignment_Index(s3, s4)
print(gaps)
[0, 5]
这个任务在python中可行吗?