Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Cipher Map by Wojtas1411
def rotate(tab):
tab2=[]
tmd=[]
for i in range(4):
for j in range(4):
tmd.append(tab[j][i])
tmd.reverse()
tab2.append(tmd)
tmd=[]
return tab2
def recall_password(cipher_grille, ciphered_password):
#to list
x=[]
y=[]
for i in range(len(cipher_grille)):
x.append(list(cipher_grille[i]))
y.append(list(ciphered_password[i]))
print(x)
print(y)
print(rotate(x))
fin=""
for i in range(4):
for j in range(4):
for k in range(4):
if x[j][k]=="X":
fin+=y[j][k]
x=rotate(x)
return fin
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'
Nov. 9, 2016