Learn String Manipulation by Building a Cipher - Step 27

Tell us what’s happening:

I do not know what to do, I keep getting an error and I see nothing wrong with the code as it prints out “Bello World” like I wanted it to, but somehow I cannot continue onto the next challenge. Is it perhaps the name of the variable?

Your code so far


/* User Editable Region */

text = 'Hello World'
first_letter = text[0]
print(first_letter)
new_text = 'B' + text[1:]
print(new_text)

/* 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/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 27

I think the clue is here:

Strings are immutable, which means they cannot be changed once created.

This step is asking you to change the string text, which you can’t. You are creating a new string, new_text and printing that. In the real world this might be a correct solution to printing something, but the lesson wants you to try to actually change the first letter within the text string.

This will not work, but that’s the point of this step, to reinforce the point.

2 Likes