display the results print('the %sed message is:(mymode) print(translated try pyperclip copy(translated print('full %sed text copied to clipboard (mymode) except pass do nothing if pyperclip wasn' installed def checkkey(key) """return true if key is valid otherwise return false "" keylist list(key letterslist list(letters keylist sort( letterslist sort( if keylist !letterslist print('there is an error in the key or symbol set ' return false return true def encryptmessage(messagekey) """encrypt the message using the key "" return translatemessage(messagekey'encrypt' def decryptmessage(messagekey) """decrypt the message using the key "" return translatemessage(messagekey'decrypt' def translatemessage(messagekeymode) """encrypt or decrypt the message using the key "" translated ' charsa letters charsb key if mode ='decrypt' for decryptingwe can use the same code as encrypting we just need to swap where the key and letters strings are used charsacharsb charsbcharsa loop through each symbol in the message for symbol in message if symbol upper(in charsa encrypt/decrypt the symbol symindex charsa find(symbol upper() if symbol isupper() translated +charsb[symindexupper( else translated +charsb[symindexlower( else the symbol is not in lettersjust add it unchanged project #