mardi 23 juin 2020

how to deshuffle from shuffle abcd in python?

i write the code to make shuffle and de_shuffle. but in de_shuffle. this my code:

def shuffle_order(plain_text,order):
   return ''.join([plain_text[i] for i in order])


def de_shuffle_order(text_rand,order):
   
   return ''.join([text_rand[i] for i in order],order)

print(shuffle_order('abcd',[2,1,3,0]))
print(de_shuffle_order('cbad',[2,1,3,0]))

my output is:

 cbda
 abdc #i want to make abcd



Aucun commentaire:

Enregistrer un commentaire