Krishn
1
Tell us what’s happening:
i dont know the logic behind the Question can you provide the logic
Your code so far
# User Editable Region
def text ():
alphabet='z'
alphabet=alphabet.find('z')
print(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/127.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 14
Don’t define a function the instructions don’t ask for this. Reset the step.
You have a string called text
and a string called alphabet
text = 'Hello World'
alphabet = 'abcdefghijklmnopqrstuvwxyz'
You can find the position of a letter in the string using find
alphabet.find('z')
print(alphabet.find('z'))
>>> 25
So ‘z’ is at the 25th position of the alphabet
string.
Now instead of finding z
, we want to find the first letter of the string text
. We access this by using text[0]
print(text[0])
>>> H
Modify your existing .find()
call passing it text[0]
as the argument instead of 'z'
.
Reset the step and modify this line as instructed:
alphabet.find('z')