So I'm trying to make an encoding/decoding program, that lets the user to type a sentence and turn it into an encoding message by replacing letters with other letters.
It works fine with one words, but when I put more words with spaces and special characters it seems to be not working.
So here is my code:
phrase = input("Write a sentence:")
decalage = int(input("By how many letters (1 to replace a with b...): "))
maping = {}
for i in range(26):
i_cesar = (i + decalage) % 26
c_cesar = chr(i_cesar + ord('a'))
c = chr(i + ord('a'))
maping[c] = c_cesar
result = ""
for c in phrase:
result = result + maping[c]
print(result)