Write a secret code program that encrypts messages entered with your own mathematical formula. For this assignment, you will add a “decoder” function to your program using lists. First, update the encoding function so that, as each character is encoded, it is placed in a list. Then, write a new decoding function that, when called, iterates over the list and prints out the original string. This is what I have so far but I'm not sure what I'm doing wrong can get some help please:
- Code: Select all
#Encoded Secret Code of the users input message and then decodes it.
encoded = '' "
'''Encodes a message for the user using a mathematical formula based off unicode'''
for a in message_user:
actual_unitary_code = ord(a)
math_formula_change = ((actual_unitary_code * 3) - 13)*2
math_formula_change = str(math_formula_change)
encoded = encoded + math_formula_change + ' '
'''Decodes the message the user gave'''
for a in encoded_unicode:
encoded_unicode = chr(a)
'''Asks user what he/she wants to encode and then returns the encoded message after using the unitary code'''
encoded_list = 
user_message = input("Please enter a message that you want to encode: \n ")
encoded = encoded_message(user_message)