I have been trying to implement tabular method for simplification of boolean expressions in python. For that I need to check whether two given strings differ at only one index for example, the function should return the following for the following examples:
- 0011and- 0111- true as the two differ only at position 1
- 0-001and- 0-101- true as differ at only 2
- 0-011and- 0-101- false as differ at 2,3
right now I am using the following function:
def match(s1,s2):
    l=[False,-1]##returns false when they cant be combined
    for i in range(len(s1)):
        if s1[:i]==s2[:i] and s1[i]!=s2[i] and s1[i+1:]==s2[i+1:]:
            l= [True,i]
            break
    return l
I want to implement it in a very fast manner (low complexity). Is there a way to do so in python?
 
     
     
     
     
     
     
     
    