lundi 29 octobre 2018

Python if statements keep skipping [duplicate]

This question already has an answer here:

To provide some context, I am looking to create a program that will encrypt and decrypt through the Caesar cipher, and I have created code for both of these functions that works quite well. However, when I try to conjoin these into one code I find that it always ignores the if statements I have in place and will always try to encrypt what the user enters. Any help would be much appreciated!

characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !?.`~@$£%^&*()_+-=[]{}|;:<>,/"
translated = ""

print("Welcome to Krypto! ")
decision = input("What would you like to do today? (encrypt, decrypt, info) ")
message = input("Please enter the text you would like to manipulate: ")

if decision == 'encrypt' or 'Encrypt':
      print ("Encrypt selected")
      #encryption begins

elif decision == 'decrypt' or 'Decrypt':
      print("Decrypt selected")
      #decryption begins

Aucun commentaire:

Enregistrer un commentaire