Learn String Manipulation by Building a Cipher - Step 4

Tell us what’s happening: I don’t understand, anyone please help?

Describe your issue in detail here.

Your code so far


/* User Editable Region */

text = 'Hello World'
print[indexW]

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 4

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.

To print the variable text use this syntax:

print(text)

To access the first character in the string stored in the variable text use this syntax:

text[0]

The number in the square brackets is referred to as the “index”. To access the character at the index 1 in the variable text use this syntax:

text[1]

Just keep in mind the numbering of the index/position starts at 0. The first position would be 0, second position is 2.

Now put those examples together and print the character in text at index 6

Hello! I’m stuck at this step as well. My code looks like this:
my_string = “Hello World”
print(my_string[6])
ChatGPT says the code is right but it’s not letting me pass.

Now, instead of printing text, print just the character at index 6.

the character at index 6 of text. Don’t use the variables given in the example, that’s just for a demonstration. You should reset it and just make a small modification to the print line.

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