Learn String Manipulation by Building a Cipher - Step 80

Tell us what’s happening:

plz help in this it is showing indentation error
kindly provide the exact indentation with code and i have already tried the available post on forum but it is not working.
the question is step 80

Your code so far

text = 'Hello Zaira!'
custom_key = 'python'

def vigenere(message, key, direction=1):
    key_index = 0
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    final_message = ''

    for char in message.lower():

# User Editable Region

 # Append space to the message
       'char' .isalpha()
       final_message += char

# User Editable Region

        else:        
            # Find the right key character to encode/decode
            key_char = key[key_index % len(key)]
            key_index += 1

            # Define the offset and the encrypted/decrypted letter
            offset = alphabet.index(key_char)
            index = alphabet.find(char)
            new_index = (index + offset*direction) % len(alphabet)
            final_message += alphabet[new_index]
    
    return final_message
    
encryption = vigenere(text, custom_key)
print(encryption)
decryption = vigenere(encryption, custom_key, -1)
print(decryption)

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 80

hi there,
you weren’t supposed to delete the if statement. You were supposed to replace the char == ' ' with the requested code.

also when you use the dot notation, don’t leave a blank space in front of the dot.
and don’t put variable names into quotes unless requested to by the step.

char is a variable, not a string.

As said, you still need the if


I can see how it can be a little confusing that it says to remove the condition, but it is just asking you to replace char == ' ' with calling .isalpha() on char

1 Like

You should replace ‘char’ .isalpha() with mod edit: code removed

hi there, this post has already been marked as solved. You do not need to respond to the OP anymore. Also please note that we disallow sharing of solution code on the forum. You are welcome to help other people here by giving them hints and tips on how to debug or how to understand the step.
Thanks for your understanding.