Step 18: Declare a new variable named shifted. Use the bracket notation to access the value of alphabet at index index and assign it to your new variable

Declare a new variable named shifted. Use the bracket notation to access the value of alphabet at index index and assign it to your new variable.

Code:
text = ‘Hello World’
index = 3
shifted = alphabet[index]
alphabet = ‘abcdefghijklmnopqrstuvwxyz’
ihhj = alphabet.find(text[0].lower())
print(index)

There’s a error.
Your code raised an error before any tests could run. Please fix it and try again.

Not sure what I’m doing wrong.

Welcome to the forum @gamingspectrum8

Please reset the step to restore the original code. Then only modify the code you are asked. The tests make specific tests in the code. Altering any part of the code you are not asked will fail the tests.

You correctly declared and assigned the shifted variable, then you added extra code.

Happy coding

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.