Learn String Manipulation by Building a Cipher - Step 28

Tell us what’s happening:

Who can help me.
I did something wrong here.

Your code so far


/* User Editable Region */

text = 'Hello World'
Albatross = text

/* User Editable Region */

shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'

for char in text.lower():
    index = alphabet.find(char)
    print(char, index)
    new_index = index + shift

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 28

Your code works as it prints (char, index).

Maybe you’ve been asked to reassign the variable text to the string ‘Albatross’?
e.g.
text = ‘Hello World’
text = ‘Albatross’

Maybe you need to print the variable new_index that inside the for loop after adding (shift)?
Please tell what you need help with.

message = 'Hello there!'

Delete the text[0] line and reassign text the string Albatross.

message is the variable
'Hello there!' is the string

Delete text[0] line and reassign the variable text the string Albatross.
text[0] = ‘C’

The syntax is this: variable = 'string'

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