Learn string manipulation - Step 25

My task was it to include upper case letters into the function which I thought I had completed as the code preview shows the letters being assigned correctly.
I wonder where I went wrong and appreciate any help you might provide.
Jonas :slight_smile:

task:
find is again returning -1 for uppercase letters, and for the space character, too. You are going to take care of the space later on.

For now, instead of iterating over text, change the for loop to iterate over text.lower().

my code:

text = ‘Hello World’
shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’

for char in text:
index = alphabet.find(char.lower())
print(char, index)

Hello Jonas,

The question mentions: change the for loop to iterate over text.lower().
So all you have to do is change the for loop, not your index variable.

2 Likes