Learn String Manipulation by Building a Cipher - Step 23

Tell us what’s happening:

i am not understanding how to do it

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

Your code so far


/* User Editable Region */

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(char)
for char in text:
    print(char)

/* User Editable Region */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 23

hello! @anshu1221yadav

You’re almost there! :tada:

index = alphabet.find(char)

This line should be the first line inside the loop body. (not before the for loop)

Hint:

hint
for char in text:
    index = task_given
    print(var_name)

Good luck!

2 Likes

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