Learn String Manipulation by Building a Cipher - Step 27

i need to change the first character in the string, it is showing the code wrong


/* User Editable Region */

text = 'Hello World'
p=text[0]


/* 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 27

Here are accessing the first letter of text and assigning it to the variable p.

It’s a bit reversed, you want to assign a different letter to the first letter of text. Start by reversing what you wrote and replacing p with a string letter (it would need to be in quotes.)

1 Like

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