I assume you want something like: def answer(plaintext): words = {“a”:’100000′,”b”:’110000′,”c”:’100100′,”d”:’100110′,”e”:’100010′,”f”:’110100′,”g”:’110110′,”h”:’110010′,”i”:’010100′,”j”:’010110′,”k”:’101000′,”l”:’111000′,”m”:’101100′,”n”:’101110′,”o”:’101010′,”p”:’111100′,”q”:’111110′,”r”:’111010′,”s”:’011100′,”t”:’011110′,”u”:’101001′,”v”:’111001′,”w”:’010111′,”x”:’010111′,”y”:’101011′,”z”:’101011′} inputList = plaintext.split(‘,’) for word in inputList: print words[word] text = “j,o,s,e” answer(text) You had a bunch of typos in your dict, pay attention to the traceback, it tells you exactly what’s wrong. You also never actually called the function you defined. You probably … Read more