Python NameError: name 'encrypt' is not defined -


when attempt run says nameerror: name 'encrypt' not defined.

max_key_size = 26 def getmode():     while true:            print('do wish encrypt or decrypt message?')            mode = input().lower()            if mode in "encrypt" 'e' 'decrypt' 'd'.split():                 return mode            else:                  print('enter either "encrypt" or "e" or "decrypt" or "d".') 

from understand of code, 'encrypt' string value. need create list required string values , check whether mode variable matches value in list.

max_key_size=26 def getmode():     while true:         mode=input().lower()         if mode in ['encrypt','e','decrypt','d']:             return mode         else:             print('enter either "encrypt" or "e" or "decrypt" or "d".') 

if want use .split() method, following:

if mode in "encrypt e decrypt d".split() 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -