Aprenda la Manipulación de Cadenas Construyendo un Cipher - Step 40

Cuéntanos qué está pasando:

I can’t solve this problem, I tried several ways, I can’t solve it, please help

Tu código hasta el momento


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''

for char in text.lower():
    char = (' ')
    print(char == (' '))
    index = alphabet.find(char)
    new_index = index + shift
    encrypted_text += alphabet[new_index]
    print('char:', char, 'encrypted text:', encrypted_text)

# User Editable Region

Información de tu navegador:

El agente de usuario es: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Información del Desafío:

Aprenda la Manipulación de Cadenas Construyendo un Cipher - Step 40

Welcome to the forum @JuanciDev

You almost got it.

  1. Please remove the following line from the editor.
  1. Remove the round braces from the string.

Happy coding

Modify delete first line, leave the line print(char == (’ ') and it doesn’t work

Hi @JuanciDev

print(char == (' ') 

The string still has parentheses. Also, the print call is missing a closing round brace.

Try removing the round brace in the middle.

Happy coding

1 Like