I've got this task for my python class that I am supposed to do, however I can't seem to print the end result. The aim of the task is to create a program that allows one to encrypt or decrypt using a offset of the users choice, it should then take that information and move the letters of that word by that offset, giving you the encrypted or decrypted product, however the problem is that it won't print, and I can't see whats wrong with it.
Here is my code:
Choice = input("Would you like to decrypt or encrypt a message? Please enter 'E' or 'D': ")
Message = input("Enter text to Cipher: ")
Offset = int(input("Please enter your offset: "))
Encrypt = ''
Decrypt = ''
if Choice == "e".upper:
for character in Message:
x = ord(character)
Encrypt += chr(Offset + x)
print (Encrypt)
if Choice == "d".upper:
for character in Message:
x = ord(character)
Decrypt += chr(Offset - x)
print (Decrypt)
"e".upper
is a method. You want "e".upper()
. Same for decrypting, of course.