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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!