Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Cipher Map by brownie57
def recall_password(cipher_grille, ciphered_password):
list = []
ans = ''
for i in range(len(cipher_grille)):
for j in range(len(cipher_grille[i])):
if cipher_grille[i][j] == 'X':
list.append([i, j])
c = 0
while c < 4:
c += 1
for x, y in list:
ans += ciphered_password[x][y]
for a in list:
a[0], a[1] = a[1], 3-a[0]
list = sorted(list, key=lambda x: x[1])
list = sorted(list, key=lambda x: x[0])
return ans
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'
Aug. 8, 2018
Comments: