I want to have the following:
Input: ("a#c","abc")
Output: True
Input:("a#c","abd")
Desired Output: False
Real Output: True
So the function returns True, if the two strings have the same length and if they differ only by the character #, which stands for a random character. If not, I want it to return False.
What should I change in this function?
def checkSolution(problem, solution):
if len(problem) != len(solution):
return False
if len(problem) == len(solution):
for i, c in zip(problem, solution):
if i != c:
return False
if i == c or "#" == c:
return True
print (checkSolution("a#c","abc"))
print (checkSolution("a#c","abd"))