0

hi i'm trying to make a secret lang on python by requesting for input of a message, then searching for certain letters in the message and replacing them with symbols and numbers. i made two lists, but need to know how to replace the letters in the string with the ones in the list. I know about the main stuff, but I've never used replace before. here's my code:

message = input('type your message')
old = ['l', 'o', 's', 'b', 'e', 'g', 'z', 'c', 't', 'a',]
new = ['1', '0', '5', '8', '3', '6', '2', '<', '+', '@',]
new_mess = message.replace(old', new)
print(new_mess)
Nyan Kat
  • 1
  • 1
  • 7
    Do a google search for your question, there are a lot of answers. Not trying to be a jerk, but people mark questions as 'duplicate' all the time, and StackOverflow would prefer to have a single location for a single question, rather than dozens of locations for a single question. – Jason Nov 02 '17 at 00:49
  • this two links might help you get started https://stackoverflow.com/questions/3588361/how-do-replace-all-occurrences-of-certain-characters https://stackoverflow.com/questions/12723751/replacing-instances-of-a-character-in-a-string – yash Nov 02 '17 at 00:52

0 Answers0