Learn String Manipulation by Building a Cipher - Step 15

Tell us what’s happening:

I don’t understand this part ''pass text[0].lower() to find() and see the output."

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(text[0])
print(index)
text[0].lower.find())

# User Editable Region

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 OPR/106.0.0.0 (Edition std-1)

Post a link to the challenge.

Remove the last code line, and add text[0].lower() between the parentheses after the word ‘find’ (as a value of the ‘find’ method).

I still don’t understand, can you explain more?

You should apply the find() method on the alphabet to find the letter at the index 0 in the string “Hello World” (the first letter “H”). That letter is uppercase, and if you don’t convert it into lowercase, the print function gives you -1 (it cannot find that letter in the alphabet’s variable value). But if you convert that letter to a lowercase, the find() method will find the corresponding letter from the alphabet variable and assign it to the ‘index’ variable.

what? I’m at step 15 man

That is it! Read the explanation again and post your code again if it doesn’t pass.

‘‘text[0].lower.find()’’ and that?

... .method(text[0].lower())

Dude, you’re making me very confused

We don’t provide final solutions here.
In my last post, the word ‘method’ is the word ‘find’.
Reset step, delete the last print call (the last code line), and add (text[0].lower()) into the following code line:

index = alphabet.find(text[0])

instead of the by default given text[0]

I got it thanks thanks

2 Likes

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