• works in the editor but fails validation

Question related to mission Cipher Map


this code works in the editor (assertions are ok) but it does not pass server validation; not sure why...

rotated90 = lambda m : zip(*m[::-1])

def letter((grid, pasw)):
    pairs=zip(grid, pasw)
    for g,p in pairs:
        if g is 'X':
    return a

def recall_password(cipher_grille, ciphered_password):
    for  i in [1]*4:
        pairs=zip(cipher_grille, ciphered_password)
        r += ''.join(map(letter, pairs))
    return r

if __name__ == '__main__':
    #These "asserts" using only for self-checking and not necessary for auto-testing
    assert recall_password(
        ('itdf','gdce','aton','qrdi')) == 'icantforgetiddqd', 'First example'
    assert recall_password(
        ('xhwc','rsqx','xqzz','fyzr')) == 'rxqrwsfzxqxzhczy', 'Second example'