Learn String Manipulation by Building a Cipher - Step 69

Tell us what’s happening:

Describe your issue in detail here.

Your code so far


# User Editable Region

text = 'Hello Zaira'
custom_key = 'python'

def vigenere(message, key):
    key_index = 0
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    encrypted_text = ''

    for char in message.lower():
    
        # Append space to the message
        if char == ' ':
            encrypted_text += char
        else:        
            # Find the right key character to encode
            key_char = key[key_index % len(key)]
            key_index += 1

            # Define the offset and the encrypted letter
            offset = alphabet.index(key_char)
            index = alphabet.find(char)
            new_index = (index + offset) % len(alphabet)
            encrypted_text += alphabet[new_index]
    
    return encrypted_text
    
# encryption = vigenere(text, custom_key, direction)
# print(encryption)

# 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/120.0.0.0 Safari/537.36 OPR/106.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 69

What am I missing from my code? I can’t seem to get out of this step even adding the # doesn’t resolve it. Thanks!

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hi, welcome to the forum!

Do you have a question or is there a part of the instructions that you don’ understand?

Check the hints and console messages for clues. What error messages are you getting?

parameters are in the function definition, add the third paramether here

1 Like

just add direction after the key I forgot what the parameters definition was, so once i googled parameters in python, i was able to figure it out as well. I wish they would have an answer key, or the option to find the answer after so many failed attempts.

@jay2kowalski If you want to help others on the forum that’s excellent, thank you!

If your main purpose is to complain about something or wish for answers on 9 days old posts, I’ll ask you to please refrain.

Thanks!

What are you talking about ? I gave him a tip and told him how a Google search helped me find the answer, I am clearly here to help others find the answers and not struggle for hours like I did.
So your comment about complaining, is unjustified, and incorrect.

1 Like

But there are many other free coding sites and I AM CONSIDERING dropping this one and finding a better one. And Nick off the keyboard tough guy attitude. I am sing this for a hobbie and want to enjoy it, I will not be bullied by you.

1 Like