• Cipher Map

 
def recall_password(cipher_grille, ciphered_password):
    def XtoCHR(m1,m2):
        newstr = ""
        for c in range(len(m1)):
            for d in range(len(m1[c])):
                if m1[c][d].lower() == "x":
                    newstr += m2[c][d]
        return newstr

    def matrixR(m,s=True):
        m2 = []
        for i in range(len(m)):
            a = ""
            for j in range(len(m[i])):
                a += m[j][i]
            m2.append(a)
        if not s:
            return m2[::-1]
        return [x[::-1] for x in m2]

    cg = list(cipher_grille)
    cp = list(ciphered_password)
    newstring = XtoCHR(cg,cp)
    for i in range(3):
        t1 = matrixR(list(cg))
        newstring += XtoCHR(cg,cp)
    return newstring

I can't pin point problem. I know I did a lot unecessery code since I thought I am working with lists not tuples. AssertionError: First example <module>, 31