This question already has an answer here:
Well, I've been trying to create a Program that has different options to choose from at the start, and to do that I used raw_input to get the users choice, and all was going fine until I put the Encrypt() function into the if Dec == "E" or "e": block, which causes the program to disregard what the user Input at the start, and just runs the first if statement, regardless of the users input.
Here is the Code:
def Encrypt():
print ("Placeholder for Full Encryption")
def Decrypt():
print ("Placeholder for Full Decryption")
def AskForDecision ():
print "Enter E to Encrypt, or D to Decrypt."
Dec = raw_input("Enter your Input:")
Dec = str(Dec)
if Dec == "E" or "e":
Encrypt()
print "E"
elif Dec == "D" or "d":
Decrypt()
print "D"
AskForDecision ()
I apologize if I happened to incorrectly describe anything, or have made the same question as someone else, I am new to the coding scene, and spent multiple hours searching for a solution to my problem to no avail, thus I have created my own question. Thank you.
Aucun commentaire:
Enregistrer un commentaire