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."