Learn String Manipulation by Building a Cipher - Step 13

Tell us what’s happening:

Above, the .find() method is called on sentence (the string to search in), and ‘r’ (the character to locate) is passed as the argument. The sentence.find(‘r’) call will return 4, which is the index of the first occurrence of ‘r’ in sentence.

At the end of your code, call .find() on alphabet and pass ‘z’ as the argument to the method.

How do I type this out correctly. I cannot seem to find where Iam going wrong

Your code so far


# User Editable Region

alphabet ='abcdefghijklmnopqrstuvwxyz'
z = 'zebra'
print(alphabet.find(z))










# 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/124.0.0.0 Safari/537.36 Edg/124.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 13

Hi there and welcome to our community!

This is the starting code for this step:

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

You’ve modified the above code considerably, so I’d hit the Reset button to restore it.
Then simply add a line of code below your alphabet variable.

You should:

call .find() on alphabet and pass 'z' as the argument to the method.

Note that you should be passing 'z' (not z) to the find() call. Also, you don’t need to put it inside a print() call.