Learn String Manipulation by Building a Cipher - Step 15

Tell us what’s happening:

Below are my workings for the Learn String Manipulation by Building a Cipher - Step 15, i have tried what i possibly could, but i am finding it hard to understand where i might have gone wrong

alphabet = 'abcdefghijklmnopqrestuwxyz'
alphabet . find(text[0])
index = alphabet . find(text[0])

i dont really understand the term “return a value” for this step either

Your code so far


# User Editable Region

alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet.find(text[0])
index= alphabet.find((text[0].lower()))


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

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 15

Hi there! Your code is right, just remove these extra spaces around the dot.

Fox example, this code will return “H”:

text = 'Hello World'
first_letter = text[0]
print(first_letter)

“H” is the value returned by this.

This is exactly what you should assign to your new variable. Don’t add extra code.

Regarding the meaning of a return value:
a return value is the value that a function/method gives you back after all the code inside it is executed. It’s something the you can use in your code.
In your case, alphabet.find(text[0]) returns a number (the index of text[0] inside alphabet) and you want to assign it to a variable to use it in your code.

I wouldn’t say that, since print() does not have a return value.

Of course, I wrote like this just for simplicity sake

ohh i see thank you so much for the help

i now understand thank you so much .