0
Help me with encryption
Maybe can think of a way to improve the code...?? https://code.sololearn.com/cxIkjhuq6nm9/?ref=app
2 Antworten
+ 1
David Romero Vaca look into this code you will got what u want..
https://code.sololearn.com/c9KHUYPf2468/?ref=app
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())