Currently doing some school programming and I'm confused as to where I've gone wrong here:
#declaring array names.
longitude=[]; latitude=[]; messagetext=[];encryptions=[];
input_file = open('messages.txt', 'r')
lines_in_file_array = input_file.read().splitlines()
input_file.close()
#appending the lines in a select file to select records.
for line in lines_in_file_array:
record_array = line.split(',')
longitude.append(record_array[0])
latitude.append(record_array[1])
messagetext.append(record_array[2])
def encrypt():
for index in range(len(messagetext)):
x=messagetext[index]
x=([ord(character)+2 for character in x])
#the character under this seems to not like being defined. I'm confused?
codedx=str.join(chr(character),'','','','')
encoded_text.append(codedx)
print(codedx)
encrypt()
print(messagetext)
I keep getting the error that "character" is not defined. I have put internal commentary to help you identify the cause.