@orbuluh

you could learn from my code :

class Solution(object):
def isOneEditDistance(self, s, t):
if s == t:
return False
l1,l2 = len(s),len(t)
if l2 - l1 > 1 or l1 - l2 >1:
return False
for i in range(min(len(s),len(t))):
if s[i] != t[i]:
if l1 == l2:
s = s[:i] + t[i] + s[i+1:] # subsitution
elif l2 > l1:
s = s[:i] + t[i] + s[i:] # insertion
else:
s = s[:i] + s[i+1:] # deletion
break
return s == t or s == t[:-1] or s[:-1] == t # checking edge case for s ="a", t = ""