Learn String Manipulation by Building a Cipher - Step 41

Tell us what’s happening:

STEP 41
Comparison operators allow you to compare two objects based on their values. You can use a comparison operator by placing it between the objects you want to compare. They return a Boolean value — namely True or False — depending on the truthfulness of the expression.

Your code so far


# User Editable Region

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

for char in text.lower():
    index = alphabet.find(char)
    new_index = index + shift
    encrypted_text += alphabet[new_index]
    print('char:', char, 'encrypted text:', encrypted_text)
   

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

Hey, please try to explain your issue.

it doesn’t look like you tried anything. What issue are you having?

i think you have to put code : at the start of the loop like it says to do
char == ’ ’ :

Thanks everybody !!!

hi i’m trying to solve this challenge but its not working out. i have tried to start with the comparison of char with empty space but still it gives me an error, even if i write the variable inside the for loop it still says error

Please open a new thread and share your code, thanks!