Learn String Manipulation by Building a Cipher - Step 14

Tell us what’s happening:

I am really not sure what I am missing here, I have tried a many methods but I keep coming up with a Type Error: invalid syntax. Any and all help/clarification would be greatly appreciated because my brain hurts at this point

Your code so far


# User Editable Region

alphabet = 'abcdefghijklmnopqrstuvwxyz'
text = "alphabet"
position = alphabet.find(text[0])  
new_position = (position + 3) % len(alphabet)
new_character = alphabet[new_position]
print(text[0])
print(position)
print(new_character)

# 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/127.0.0.0 Safari/537.36 Edg/127.0.0.0

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 14

Hi there and welcome to our community!

Ok, the first thing I’d do is hit the Reset button to restore the starting code for this step, as you have a lot of additional and modified code which shouldn’t be there.

This is the starting code:

text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet.find('z')

The instructions are:

Modify your existing .find() call passing it text[0] as the argument instead of 'z' .

So, all you need to do is make the above minor modification to the final line of code above.

1 Like

thanks a lot for your help

1 Like