Question: def sphinx_switches(start, goal, Limit): A diff function for autocorrect that determines how many letters in START need to be substituted to create GOAL, then adds
def sphinx_switches(start, goal, Limit): "A diff function for autocorrect that determines how many letters in START need to be substituted to create GOAL, then adds the difference in their lengths and returns the result. 1 Arguments: start: a starting word goal: a string representing a desired goal word limit: a number representing an upper bound on the number of chars that must change >>> big_limit = 10 >>> Sphinx_switches ("nice", "rice", big_limit) # Substitute: n-> >>> sphinx_switches("range", "rungs", big_limit)Substitute: a -> U, e-> S >>> sphinx_switches ("pill", "piltage", big_limit) # Don't substitute anything, length difference of 3. >>> sphinx_switches ("roses", "arose", big_limit) # Substitute: r -> 2, 0 ->r, s-> 0, e-> S, S -> 5 >>> sphinx_switches("rose", "hello", big_limit) # Substitute: r->h, 0->e, s->l, e->l, length difference of 1. 5 2 3 CC
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
