Learn String Manipulation by Building a Cipher - Step 27

Tell us what’s happening:

i don´t know what to do after text[0]
i try to t change, but i don´t know how

Your code so far


# User Editable Region

text = 'Hello World'

# User Editable Region

shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'

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

i can´t continue

I don´t understan very well what to do

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 27

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Welcome to our community!

After this code line, add the same variable and use the bracket notation, immediately after the name of the variable (which means, add the [ ]). To access the first letter in the text 'Hello World' put the index 0 (number 0) between the square brackets [ ]

Step 27

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

Use bracket notation to access the first letter in text and try to change it into a character of your choice.

That’s what the task asks us to do. It took me about thirty minutes to figure it out.

After: text = ‘Hello World’
SOLUTION REMOVED***

The bracket notation “[ ]” will hold the numerical value of a letter in the first letter in the ‘Hello World’ string, “0 = h, 1 = e, 2 = l, 3 =l, 4 =o, etc”. So “text[0]” is the show the first letter of the ‘Hello World’ string.

The “=” is the call to action.

The string " ’ ’ " can be any letter in the alphabet of your choosing.

I hope this helped. Happy coding and learning!

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

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