I don’t understand what is wrong. The directions are not clear enough, IMO. I have read all of the other forum posts on this step, but I can’t figure out what is wrong with my code.
Your code so far
/* User Editable Region */
message = 'Hello Zaira'
offset = 3
def caesar(message, offset):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_message = ''
for char in message.lower():
if char == ' ':
encrypted_message += char
else:
index = alphabet.find(char)
new_index = (index + offset) % len(alphabet)
encrypted_message += alphabet[new_index]
print('plain message:', message)
print('encrypted message:', encrypted_message)
caesar()
/* User Editable Region */
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 49