Your question is Edits Within Two Steps. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Viasat network diagnostics may compare normalized telemetry tokens that differ because of a single transmission or formatting error. Given two words, determine whether the second can be obtained from the first using fewer than two edits.
An edit is exactly one of the following:
Zero edits is also valid. Character substitutions are not valid unless they are produced by a swap. Return True if the transformation requires zero or one edit, and otherwise return False.
Implement one_edit_or_swap(word1, word2), where both inputs are strings. Return a boolean. The comparison is case-sensitive, and characters may be any standard string characters.
def one_edit_or_swap(word1, word2):