Learn String Manipulation by Building a Cipher - Step 29

Tell us what’s happening:

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().

for char in text.low(): index = alphabet.find(char) print(char,index)
where I did wrong?

Your code so far


# User Editable Region

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

for char in text.low():
    index = alphabet.find(char)
    print(char, 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/123.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 29

try with lower not low