Caesar cipher in Python, exercise

153 Views Asked by At

I'm stuck in solving the following exercise:

"*From the standard input you will get an integer n and a message encrypted by Caesar cipher (i.e. shifted by n letters down the alphabet). Decrypt the message and print it.

Hint: Functions chr a ord, function print with parameter end=''.

Try Also:
-3#Jrf rf rnxz*"

**Sample Input:
5#Rfrf rjqj rfxt**

**Sample Output:
Mama mele maso**

The code I've wrote is the following:

posun, zprava = input().split("#")

for i in zprava:
    a = ord(i) - int(posun)
    print(chr(a), end='')

But except for having the requested output, the exercise is tagged as wrong. Any suggestion?

0

There are 0 best solutions below