1

having a issue with a input error Just giving them options of what they wanna input instead of yes or no code:

def getMode():
    while True:
        print('do you wish to encrypt or decrypt a message?')
        mode = input().lower()
        if mode in [ 'encrypt', 'e', 'decrypt', 'd']:
            return mode
         else:
            print('Enter either "encrypt or "e" or "decrypt", "d".')

Error:

Traceback (most recent call last):
  File "/Users/gomcrai/pythings/caesarCipher.py", line 46, in <module>
    mode = getMode()
  File "/Users/gomcrai/pythings/caesarCipher.py", line 8, in getMode
    mode = input().lower()
  File "<string>", line 1, in <module>
NameError: name 'e' is not defined

Only thing happening on line 46 is the function is being called

Craig A Gomez
  • 139
  • 3
  • 12

0 Answers0