Help me with encryption | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me with encryption

Maybe can think of a way to improve the code...?? https://code.sololearn.com/cxIkjhuq6nm9/?ref=app

2nd Dec 2020, 9:28 AM
David Romero Vaca
David Romero Vaca - avatar
2 Answers
+ 1
David Romero Vaca look into this code you will got what u want.. https://code.sololearn.com/c9KHUYPf2468/?ref=app
2nd Dec 2020, 9:26 PM
Ratnapal Shende
Ratnapal Shende - avatar
0
#pls i need to know if the problem have another alternative solution (not manual solution as my code). Ty. def encrypt(msg): Chars_x="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ " Chars_y="zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA " msg_cifrado="" for x in msg: for n in range(len(Chars_x)): if x==Chars_x[n]: msg_cifrado+=Chars_y[n] return msg_cifrado def decrypt(msg): Chars_y="abcdefghijklmnñopqsrtuvwyxzABCDEFGHIJKLMNÑOPQSRTUVWYXZ0123456789,.;()? " Chars_x="plmoknijbuhvñygctfxrdzeswaqQAZWSXEDCRFVTGBYÑHNUJMIKOLP7531902468(,;.?) " msg_cifrado="" for x in msg: for n in range(len(Chars_x)): if x==Chars_x[n]: msg_cifrado+=Chars_y[n] return msg_cifrado msg=input("Print a word or sentence: ") msgx=encrypt(msg) print("\nThe result with lowercase letters is:\n ",msgx.lower())
2nd Dec 2020, 8:43 PM
David Romero Vaca
David Romero Vaca - avatar