mardi 22 novembre 2016

What is the if statement doing in the code?

edited = False
i, j = 0, 0
while i < len(s1) and j < len(s2):
    if s1[i] != s2[j]:
        if edited:
            return False
        edited = True
        j += 1
    else:
        i += 1
        j += 1
return True

What is the code doing in the if edited statement? So if it's False, it returns False?

Source: http://ift.tt/2geYUAI

Aucun commentaire:

Enregistrer un commentaire