I'm new to programming so let me know if you need anymore details but I've been having trouble getting this to output 2 instead of 1. Problem is I don't understand how to read read the last piece of code!
def sphinx_swap(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.
"""
# BEGIN PROBLEM 6
if len(start) == 0 or len(goal) == 0:
return abs(len(start) - (len(goal)))
elif limit == 0:
return 1
elif start[0] != goal[0]:
return 1 + sphinx_swap(start[1:], goal[1:], limit - 1)
else:
return sphinx_swap(start[1:], goal[1:], limit)
sum([sphinx_swap('yond', 'yo', k) > k for k in range(4)]) #line I don't understand