Learn String Manipulation by Building a Cipher - Step 16

Hey I couldn’t complete this level.
Can someone help?

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 (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

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hello zsombi.molnar2008, welcome to the forum!

You are very close, but right now you are getting the alphabet letter at the index (7) and are trying to add shift (3) to the letter.
Instead you need to get the alphabet letter at index + shift. Hint: shift (3) + index (7) would together be 10. So we are expecting to get the 10th letter. Just writing the integers though wouldn’t be very neat, so instead maybe you can add the variables together to find the letter, instead of just using index ?

1 Like

Thanks I got it! Now it works

2 Likes