I am new to python and can't seem to get the 3rd input line to work with the "method" if loops. How would I get them to acknowledge the string "encrypt" or "decrypt"? When I run the program it takes the input but will still run through my second "method" input.
message = input("Enter the message you wish to encrypt or decrypt:")
shift_key = int(input("Enter the key value:"))
method = str(input("Would you like to encrypt or decrypt a message?"))
if method != str("encrypt") or method != str("decrypt"):
method = input("Enter either encrypt or decrypt")
else:
if method == str("encrypt"):
encrypted_message = ""
for character in message:
if character.isalpha() == True:
if character == character.lower():
x = ord(character) -97
x += int(shift_key)
x = x % 26
encrypted_message += chr(x + 97)
else:
x = ord(character) -65
x += int(shift_key)
x = x % 26
encrypted_message += chr(x + 65)
else:
encrypted_message += character
print(encrypted_message)
else method == str("decrypt"):
decrypted_message = ""
for character in message:
if character.isalpha() == True:
if character == character.lower():
x = ord(character) -97
x += int(-shift_key)
x = x % 26
encrypted_message += chr(x + 97)
else:
x = ord(character) -65
x += int(-shift_key)
x = x % 26
encrypted_message += chr(x + 65)
else:
decrypted_message += character
print(decrypted_message)
