Ive created a dictionary with all the letters of the alphabet, assigning each one to another random letter.
encode={'b':'a','B':'A','c':'e','C':'E','d':'i','D':'I','f':'o','F':'O','g':'
u','G':'U','h':'b','H':'B','j':'c','J':'C','k':'d','K':'D','l':'f','L':'F','m
':'g','M':'G','n':'h','N':'H','p':'j','P':'J','q':'k','Q':'K','r':'l','R':'L'
,'s':'m','S':'M','t':'n','T':'N','v':'p','V':'P','w':'q','W':'Q','x':'r','X':
'R','y':'s','Y':'S','Z':'t','z':'T','a':'v','A':'V','e':'w','E':'W','i':'x','
I':'X','o':'y','O':'Y','u':'Z','U':'z',' ':' ','!':'!'}
Now what Im trying to do is to create a single function that takes the input, does the calculation, and produces the output, using the letter from the input to be the key of the value.
What I have in mind is to convert the dictionary into a list, then use the list to look up the user input and encode the message. This idea doesnt seem to be very efficient.
Any other suggestions?