Learn String Manipulation by Building a Cipher - Step 16

Tell us what’s happening:

I’m trying to get a lowercase letter to show up while still keeping print(index) in the code. What specifically am I doing wrong with this code that is preventing it from passing?

Your code so far


# User Editable Region

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

# 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

Ultimately, I guess I’m just confused on what its asking for and the method its asking for. Looking on other forms, I found a “shifted” instruction, but the directions for this step were as follows:

".find() returns the index of the matching character inside the string. If the character is not found, it returns -1. As you can see, the first character in text, uppercase 'H', is not found, since alphabet contains only lowercase letters.

You can transform a string into its lowercase equivalent with the .lower() method. Add another print() call to print text.lower() and see the output."

Hello @StarrySky5324,
Instead of posting like this you can add links to the code so we can go and check it directly…
To add a link when you try 3 times or more than that to submit your answer you can click A Help button that’s how you do it…

But for now!
After your 1st print statement You have to print,text.lower()
Good Luck with it!

please do not remove the link from the pregenerated post content!

anyway, the instructions for this step are

Add another print() call to print text.lower() and see the output.

reset the code and add an other print call as asked

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