Question: Implement function q2(string1, string2, num) so that it returns True if the input strings are the same length and differ at exactly num character positions,
Implement function q2(string1, string2, num) so that it returns True if the input strings are the same length and differ at exactly num character positions, and returns False otherwise. NOTE: Use a simple loop comparing corresponding characters direclty. You may not use any string methods. For example
>>> q3("bat", "bet", 1) True
>>> q3("art", "rat", 1) False
>>> q3("art", "ran", 1) False
>>> q3("art", "rat", 2) True
>>> q3("art", "ran", 3) True
>>> q3("abcde", "abada", 2) True
IN PYTHON
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
