Learn String Manipulation by Building a Cipher - Step 49

Error says “You should rename text to message”; however, the word ‘text’ is nowhere in my code.

What am I missing? Thank you!

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()

It’s not required to change the literal string that’s printed.

2 Likes

hi, i found the solution

Mod Edit SOLUTION REMOVED

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Ok!, I didn’t know it, I’m sorry

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.