Learn String Manipulation by Building a Cipher - Step 15

Tell us what’s happening:

why it’s so complicated for beginners…

Your code so far

# User Editable Region
text = 'Hello World'
shift = 3
aphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet.find(text[0])
index = 'alphabet.find(text[0])'

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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 15

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/learn-string-manipulation-by-building-a-cipher/655208d59b131e7816f18c96.md at main · freeCodeCamp/freeCodeCamp · GitHub

maybe you want to follow the new python curriculum? https://www.freecodecamp.org/learn/python-v9/

it’s more gradual

here tho, if you want for the expression

to actually run, you can’t surround it in quotes, the quotes make it a string, and the characters inside a string are taken as is, they don’t evaluate to an index value

The main issue is the quotes around alphabet.find(text[0]). Use index = alphabet.find(text[0]) so Python actually runs the function instead of storing it as text. Also fix the aphabet typo.

Do you see the error in the console?

line 4
NameError: name 'alphabet' is not defined

You should use this to find a problem.

Investigate line 4. Why would alphabet not be defined? Investigate where you define alphabet