/* User Editable Region */
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
Index = alphabet.find(text[0].lower())
index = alphabet[Index]
print(index)
shift= alphabet[shift]
shifted = index + shift
print(shifted)
/* 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/119.0.0.0 Safari/537.36 OPR/105.0.0.0
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 16
I would strongly not recommend using the same variable name but differently capatalized as that’s going to get confusing very fast.
Anyway, the question doesn’t ask you to change any of the original code except adding a new variable called shifted, in which you need to get the alphabet letter at index plus shift.
It seems like you already understood how to get letters out of alphabet using one variable. But did you know that if for example you wanted to get the 3rd letter of a string you can also do string_var[2+2] this question uses the same concept, but instead it uses index + shift and not direct integers.
I hope this helps, but if not please feel free to ask more questions.