Learn String Manipulation by Building a Cipher - Step 35

Tell us what’s happening:text = ‘Hello World’

shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’

for char in text.lower():
index = alphabet.find(char)
print(char, index)
new_index = index + shift
new_char = alphabet[new_index]
print(‘char:’,char,‘new char’,new_char)
I’m new learner want to learn something from this protal

Your code so far


# User Editable Region

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

for char in text.lower():
    index = alphabet.find(char)
    print(char, index)
    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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 35

Hi there, welcome to the community!

Regarding your code, the lesson asked you to:

Clean the output a bit. Delete print(char, index), and turn the last print() call into
print('char:', char, 'new char:', new_char)

However, you’re not fully following the instructions yet:

  1. Please remove the first print() inside the loop that prints char and index.
  2. Also, make sure you are including the colons (:) in the final print statement exactly as asked.

Fixing these should help you pass the test. Let me know if you need help with anything else! :blush: