Learn String Manipulation by Building a Cipher - Step 36

Ive changed it to what its teling me to but its stiul saying chanbge it


# User Editable Region

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

for char in text.lower():
    index = alphabet.find(char)

    new_index = index + shift
    new_char = alphabet[new_index]
    print('char:', char, 'new_char:', new_char)

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 36

You have an extra underscore in the literal string 'new_char:'. Only the variable should have it.

thanks, why is that?

Can you explain what you are asking?

This is what the instruction asks for:

turn the last print() call into print('char:', char, 'new char:', new_char).

You need to follow it exactly

You have an extra underscore in the literal string 'new_char:' . Only the variable should have it. Im asking why?

This is what the request gave you and asked that you call within a print.

call into print('char:', char, 'new char:', new_char).

This is what you originally posted.

One literal string concatenated with a variable plus another literal string concatenated with another variable. However, the second literal string is supposed to be 'new char: ' instead of 'new_char:', thus the ‘_’ character is unwanted.

1 Like

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