Skip to content Skip to sidebar Skip to footer

Caesar Cipher In Python

The error which i am getting is Traceback (most recent call last): File 'imp.py', line 52, in mode = getMode() File 'imp.py', line 8, in getMode mode = i

Solution 1:

The problem is here:

print('Do you wish to encrypt or decrypt a message?')
mode = input().lower()

In Python 2.x input use raw_input() instead of input().

Python 2.x:

  • Read a string from standard input: raw_input()
  • Read a string from standard input and then evaluate it: input().

Python 3.x:

  • Read a string from standard input: input()
  • Read a string from standard input and then evaluate it: eval(input()).

Solution 2:

input()evaluates the expression you type. Use raw_input() instead.

Post a Comment for "Caesar Cipher In Python"