Hi everyone,
I am trying to work on the coded correspondance project. So the idea is to create a code that shifts back ten letters of the alphabet. I have the exercise correct but if I write the message in uppercase the outcome is always de letter “p”
alphabet = "abcdefghijklmnopqrstuvwxyz"
punctuation = " ,!"
message = "TEXT me, to my office number, as soon as you finish the project!"
coded_message = ""
for letter in message:
if not letter in punctuation:
letter_value = alphabet.find(letter)
coded_message += alphabet[(letter_value - 10) % 26]
else:
coded_message += letter
print(coded_message)
The output will be:
pppp cu, je co evvysu dkcruh, qi ieed qi oek vydyix jxu fhezusj!
Why is this?
Thank you!