Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in 3rd party category for Cipher Map by melissareyesq
import numpy as np
def recall_password(cipher_grille, ciphered_password):
retorno = ''
lista = []
for elemento in cipher_grille:
lista.append(list(elemento))
mgrille = np.array(lista)
lista = []
for elemento in ciphered_password:
lista.append(list(elemento))
mpass = np.array(lista)
mgrille = mgrille == 'X'
retorno += ''.join(list(mpass[mgrille]))
mgrille = np.rot90(mgrille, 3)
retorno += ''.join(list(mpass[mgrille]))
mgrille = np.rot90(mgrille, 3)
retorno += ''.join(list(mpass[mgrille]))
mgrille = np.rot90(mgrille, 3)
retorno += ''.join(list(mpass[mgrille]))
return retorno
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert recall_password(
('X...',
'..X.',
'X..X',
'....'),
('itdf',
'gdce',
'aton',
'qrdi')) == 'icantforgetiddqd', 'First example'
assert recall_password(
('....',
'X..X',
'.X..',
'...X'),
('xhwc',
'rsqx',
'xqzz',
'fyzr')) == 'rxqrwsfzxqxzhczy', 'Second example'
Jan. 17, 2017
Comments: