what code should I write to pass step 16 Learn String Manipulation by Building a Cipher -
Your code so far
# User Editable Region
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(text[0].lower())
shifted='d+shift
'
# 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/120.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 16
Don’t change the given code in this challenge. You have deleted the print function.
Restart the step.
The instructions: " Declare a variable named shifted and assign it the alphabet letter at index plus shift"
The variable’s value should be a letter from the alphabet variable at the index index + shift:
variable = alphabetvariable[required index shown above]
This is guidance.
Don’t use single quotes around the assigned value.
thank u so much for your help but I can’t figure out the value of the variable I declared .
i tried this but it didn’t work out:
text = ‘Hello World’
shift = 3
alphabet = ‘abcdefghijklmnopqrstuvwxyz’
index = alphabet.find(text[0].lower())
print(text.lower())
shifted= h+3
they needed to find the letter at index 7 in the “alphabet” variable wich is ‘h’ plus the value of variable “shift” wich is '3 ’ THAT’s why I writed: shifted= h+3
You have to find the letter from the alphabet variable, at the index: index + shift. The index and the shift are already declared variables. Instead of using a concrete letter and the value of the ‘shift’ variable, you should use as index: [index + shift]: