Learn String Manipulation by Building a Cipher - Step 16

Tell us what’s happening:

I cannot see what is wrong with this code, it does exactly what is asked.
Declare a variable named shifted and assign it the alphabet letter at index plus shift .

Your code so far


/* User Editable Region */

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
index = alphabet.find(text[0].lower())
print(index)
shifted = (alphabet[index + shift])

/* 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/111.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 16

What are the extra ()s doing there?

1 Like