Can’t progress past this step. Keeps telling me my code is wrong, even though the console next to me keeps printing >>>0. it keeps telling me I need to pass text[0] into the find function, but I thought that’s what I was doing when I typed out alphabet.find (text[0]), but then when i do that instead of alphabet.find (‘a’) the console doesn’t print anything. Please help me, I can’t figure out what I’m doing wrong.
Your code so far
/* User Editable Region */
alphabet = 'abcdefghijklmnopqrstuvwxyz'
text = alphabet.find ('a')
print(text)
/* 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
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 12
Hi @kilen.specht! Welcome to the freeCodeCamp forum.
it keeps telling me I need to pass text[0] into the find function, but I thought that’s what I was doing when I typed out alphabet.find (text[0])
What you were doing above seems correct, but you appear to have edited too much code now.
In the challenge instruction, it says:
At the end of your code, call find() on your alphabet string and pass text[0] to the function.
I recommend resetting the code for this lesson. There is a reset button below the “Check Your Code” button.
Then, add your code at the end. In this step, you don’t need to print the value yet.
however, just for fun, if i type this code into the python idle shell, i get an error saying that the term text is not defined. I don’t understand that.
No I didn’t, because I thought that the question was asking me to find the character in ‘abcdefghijklmnopqrstuvwxyz’, not in ‘Hello World’. It seems like no matter what I write in the python shell i still get it wrong in there, even if the code challenge says i was right.
If you don’t define the text variable in your local python shell, how would it access it?
That’s why it says text is not defined
Hard to say what’s happening in your local shell prompt. You could try it in google colab, then you can more easily put the whole block of code in and run it.