def fnDecrypt():
key = raw_input("Please type the offset factor key: ")
name = raw_input("Please enter the name of the file you want to decrypt: ")
offset_factor = key
encrypted_message = open(name,'r')
message = encrypted_message.read()
print "The contents of the file you are decrypting is: " + message
for c in message:
number = ord(c)
if c != " ":
number -= offset_factor
if number > 126:
number = number + 94
new_character = chr(number)
encrypted_message -= new_character
print 1
print encrypted_message
return;
this code is supposed to decrypt a encrypted message using the same eight character key that was used to encrypt it.At the minute i have this error message : UnboundLocalError: local variable 'new_character' referenced before assignment