Learn String Manipulation by Building a Cipher - Step 27

Tell us what’s happening:

Describe your issue in detail here.
I don’t understand how to assign the value returned by alphabet.find(char) to index.

Your code so far

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'

# User Editable Region

for char in text:
    index = 82
    print(char)
    #I added up the value of alphabet.find(char) and got 82. What did I do wrong?

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15

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.

text = ‘Hello World’
shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’

for char in text:
index = alphabet.find(char)
print(char)

try to run this code .

Welcome to the forum @5452644636

Here are the instructions:

Inside the for loop, before printing the current character, declare a variable called index and assign the value returned by alphabet.find(char) to this variable.

This challenge wants you to code a variable using the .find method.

Inside the for loop, declare the new variable and assign it the expression mentioned in the instructions.

Happy coding

here you are assigning a value to index, do the same but put your expression instead of 82

1 Like

Thank you I must’ve been overthinking it!

1 Like

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