Learn String Manipulation by Building a Cipher - Step 70

Tell us what’s happening:

I already turned the two last lines into comments, didn’t I? What should I do? The other codes are equal to mine, but it’s saying I need to put the # knowing I already did it

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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 70

you need to comment out without changing the last two lines, you changed them so the tests don’t recognise them anymore. Reset the step and try again

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