I am trying to do this simple encoding program for class. It is supposed to encode it using the ASCII chart and some slight modding of the number. Then it should be written to a file 'encryptedmessage.txt' for later reading by a decoder later. My issue is I dont know how to add newMessage so I can write it to file. I can't use the for loop in the output file. Any help would be appreciated. i tried searching but everything I found was actually more complex then what we are into as of now. Thank you for taking the time to read this.
def main(): #declare and initialize variables #string message newMessage = message = "" #Intro print("+++++++++++++++++++++++++++++++") print("Welcome to the encoder program!") print("+++++++++++++++++++++++++++++++") #Prompt the user for the message message = input("Please enter the message you would like to encode: ") #Loop through message for ch in message: #Print and calculate the new value of message print(ord(ch) * 6 - 5, end = " ") #Open a the file “encryptedmessage.txt” outfile = open("encryptedmessage.txt", "w") #Write to file “encryptedmessage.txt” #Close the file outfile.close