The python compiler keeps giving me the message “Sorry, your code does not pass. Hang in there.” But the hint it is providing is " You should assign the alphabet letter at the index index + shift to your new variable." which seems pretty similar which I also did as per requirement mentioned in the question but then also it keeps giving me the error message “Sorry, your code does not pass. Hang in there.”. It will be helpful if some advice is provided to proceed further…
Your code so far
text = ‘Hello World’
shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’
index = alphabet.find(text[0].lower())
print(index)
shifted = index + shift
User Editable Region
text = ‘Hello World’
shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’
index = alphabet.find(text[0].lower())
print(index)
shifted = index + shift
User Editable Region
### Your browser information:
User Agent is: <code>Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36</code>
### Challenge Information:
Learn String Manipulation by Building a Cipher - Step 16
https://www.freecodecamp.org/learn/scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/step-16
But your suggested solution doesn’t seems to work …as you can see from the screenshot attached… Please suggest me if i’m doing something wrong as per your suggestion…
use [] square brackets not () common brackets. in the solution also it is [] square brackets. the spelling of alphabet is wrong in the given screenshot.
Thanks a ton for the solution … can you please explain why the square brackets were used instead of normal brackets () ? Also I was a little bit confused why we used the “alphabet” with the brackets again during the addition as in the question it is mentioned “assign it the alphabet letter at the index” and why do we need to associate “shift” value (3) with the “alphabet”. The solutions for me seems to create a little bit confusion…
Also, can you tell me is there any section where I can find the solutions with explanation ?