Question: PYTHON HW #4: Arrays and Strings / 2. Question 2 Saved DESCRIPTION GRADING 59 MY TEST 1 There are three types of edits that can

HW #4: Arrays and Strings / 2. Question 2 Saved DESCRIPTION GRADING 59 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 (or zero edits) away. EXAMPLE: pale, ple -> true (letter a between p and I was removed in the first string or added in the second string. 1 edit) pales, pale -> true (letter s 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 b in the first string or letter b was replaced to p in the second string. 1 edit) pale, bae -> false (letter p was replaced to b and I was removed in the first string. 2 edits) abcd, dcba -> false (a replaced to d, b replaced to c, c replaced to b, and d replaced to d. 4 edits) code.py New 1 - def isoneEditAway(stri, str2): 2 pass Full Screen
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
