i am new to python programing, and was wondering if anyone could help me with encoding a message. for example if my dictionary is {'x': 'e', 'e': 'x'} and i would like to encode 'hello world' so that is prints 'hxllo world'
In [ ]: encode(code, "Hello World")
Out[ ]: 'Hxllo World'
translate. See this: tutorialspoint.com/python/string_translate.htmcodeinencode, is that just the dictionary?return ''.join(...)where...is replaced by an appropriate comprehension.