Learn String Manipulation by Building a Cipher - Step 41

I am not able to proceed even the if the code is working perfectly. What should I do???
the step demanded the italicized statement in my code below.


# User Editable Region

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
    *emphasized text*print (char == (' '))
    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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 41

Hi there and welcome to our community!

If you remove the parentheses around the quote marks, your code should pass.

2 Likes

Hi, thanks for the welcome.
I have tried it is not working.

Can you share your modified code please?
I pasted your code in and it passed when I removed the parentheses around the quote marks.

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

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

1 Like

1 Like

Judging by that screenshot, your code should be passing, unless I’m missing something obvious.

However, you should be able to resolve this by hitting the Reset button and then typing that print command again exactly as it appears in your screenshot.

I tried skipping to the next part and now I am at 44th step. I guess it is just a bug of some sort maybe??? Btw the 42nd step’s start was same as my code.

There appears to be a space after the colon in the for loop.

Happy coding

1 Like

Notice there should be a space in between ’ ’
by default it just shows ’ ’ so you have to insert a space ’ ’

print(char == ‘space’)
hope this helps

---- removed ----

try this

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

@pkdvalis
I’m so sorry for that, I didn’t know :pray:t2::pray:t2:anyway, thank you for your concern, I’ll be more careful next time :+1:t2::smile: