Question: python. here is my code for this question, but when str1= xyz and str2= xzw it should return false, because we have 2 edits, but

python. here is my code for this question, but when str1= xyz and str2= xzw it should return false, because we have 2 edits, but my code returns true, because it only looks at the different letters, and not at the way the letters are inserted. can someone help me with this problem please  python. here is my code for this question, but when str1=
xyz and str2= xzw it should return false, because we have 2

assignments/ff7a93a9-73a2-4e-8e5f-407bc9348bc1/do/116773a9-da95 4491-60b7-e11258 HW 4 Arrays and Strings 2. Question 2 saved DESCRIPTION GRADING 48 11 MY TEST 1 There are three types of edits that can be performed on strings: Insert a character, remove a character, or replace a character. Given two strings, write a function to check if they are one edit for zero edits) away. EXAMPLE pale, ple -> true letter a between pand I was removed in the first string or added in the second string. 1 edit) pales, pale ->true [letters was removed at the end of the first string or added in the second string. 1 edit) pale, bale ->true letter p was replaced to in the first string or letter b was replaced to p in the second string. 1 edit) pale, bae -> false lletter p was replaced to b and I was removed in the first string 2 edits] abcd. dcba -> false la replaced to db replaced to c.creplaced to b, and d replaced to d. 4 edits) 10 19 hp character. nction to Full or added in added in the was code.py New 1. def isoneEditAway (stri, str2): 2 test=0 3 if str1==str2: 4 return True 5 for i in stri: 6 for j in str2: 7 if i==j: 8 test+=1 9 10 test2=len(str1) - test 11 if len(stri)1: 17 return false 18 else: 19 return True Trst string 2 nd d replaced

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!