Can anyone help me with this I'm a bit stupid sorry

Tell us what’s happening:

I just don’t understand very well how to use ‘‘find()’’

Your code so far


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
find(char(alphabet))
text[0]

# User Editable Region

Please post a link to the Step. Thanks

find() is a function, and when you use a function with a variable, the format usually looks like this,

variableHere.functionHere()

The variable goes first and the function comes after, with a period separating them.

The variable of interest is alphabet because that is where to find the index position
of text[0]

Again, the format when using function with a variable looks like this,

variableHere.functionHere()

The alphabet variable is where the index position can be found, which is what the challenge is asking for.

Finally, passing/putting arguments in the parenthesis in the find function is to specify exactly which letter’s index position is it that you want to find in the alphabet variable, so the whole thing should look like this.

variableHere.functionHere(argumentHere)

and like this ‘‘alphabet.find(‘a’)’’

which challenge is this? Step 12?

It’s a Caesar cipher.

which step in the caesar cipher is this question from? There are 91 steps in the caesar cipher. Which step is this from?

the first stage I’m still a beginner

again, there are 91 steps/challenges in the caesar cipher, which one are you referring to with this question? Which step?

I’m talking about twelve

If you are on step 12, then this line is almost correct, except that this challenge isn’t asking for where ‘a’ is at,

it’s asking for what the index position in the alphabet variable corresponds to the first letter of the text variable.

‘a’ isn’t the letter that’s being asked for, as far it’s corresponding index position in the alphabet variable.

It’s asking for text[0]

text[0] is referring to the text variable.
And specifically the first letter in the text variable, because in Python, the letters are counted starting from 0, so what letter is in zero position in the text variable?

theoretically it is ‘a’, isn’t it?

no, not in the alphabet variable, in the text variable, there are two variables in this block of code.

text is a variable
alphabet is also a variable

what the challenge is asking for is that it wants the first letter in the text variable, which is represented as text[0]

And then finding what the corresponding index position it has in the alphabet variable. That’s what this step is asking for.

do I have to do both?

in the one line of code that this challenge wants, it involves the text variable and the alphabet variable, but it only wants

one line of code,

you already have most of it correct, except for the argument.

alphabet.find(butwhatgoeshere?)

alphabet.find() is a way of saying, find the index position in the alphabet variable that corresponds to the argument within the parenthesis of the find function.

Remember it’s not ‘a’ that you’re looking for.
You want to put in an argument that represents the first letter in the text variable.

alphabet.find(text(0)) That’s not it, right?

very close, but look again at the instructions for this step,
does it say
text(0) or text[0]

???

Here’s a hint: parenthesis and brackets have different meanings.

Thank you very much I got it

1 Like

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