Learn String Manipulation by Building a Cipher - Step 51

Tell us what’s happening:

I keep getting marked incorrect but I don’t know what the issue is. I’m calling the function with the variable text and the number 13. output is correct

Your code so far


# User Editable Region

text = 'Hello Zaira'
shift = 3

def caesar(message, offset):
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_text = ''

    for char in message.lower():
        if char == ' ':
            encrypted_text += char
        else:
            index = alphabet.find(char)
            new_index = (index + offset) % len(alphabet)
            encrypted_text += alphabet[new_index]
    print('plain text:', message)
    print('encrypted text:', encrypted_text)

caesar(text, 13)

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 51

Hi @reyrascon and welcome tho the FCC Community!

You need to keep the existing function call and instead call a new one below it according to the challenge instructions.

1 Like

Welcome to our community!

Don’t delete the first print call given by default in this challenge. Just add another one following the instructions.

2 Likes

that was it, thank you so much!

2 Likes

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