Learn String Manipulation by Building a Cipher - Step 67

Tell us what’s happening:

please give the solution of my given code
please

Your code so far

 offset = alphabet.index(key_char)
            index = alphabet.find(char)

# User Editable Region

            new_index = (index + offset) % len(alphabet)
            encrypted_text += alphabet[new_index]
            key_index += 1

        return 'spam'

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 67

You have been asked to return encrypted_text. Why are you returning 'spam'?

Hello @rr7499042
This challenge asks you to:

Remove the two print() calls from your function and return encrypted_text .

From your code I see you correctly removed the print() calls and added the return statement in the right place.

The issue is what you are returning: right now you are returning the string 'spam' rather than the value hold by the variable encrypted_text.

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