Tell us what’s happening: i’m stuck I don’t know what to do I’ve reset the exercise multiple times already and I can’t figure out what to do I was told once before that operator I used was an empty string with that being said I’ve read multiple forms about this topic and I still can’t figure out what the issue is.
Describe your issue in detail here.
Your code so far
# User Editable Region
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
char == ' '
index = alphabet.find(char)
new_index = index + shift
encrypted_text += alphabet[new_index]
print('char:', char, 'encrypted text:', encrypted_text)
print()
# 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/121.0.0.0 Safari/537.36 OPR/107.0.0.0
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 41
thanks for the help but once again the result of my code returned false even when I print the word char in the next line of code in the loop the terminal spaces the words out like its supposed too but when I run the code it keeps telling me that I should pass it through the for loop and I’ve done that every time but it doesn’t work I’ve reset it a bunch of times too and every time It gives me the same hint every time so at this point i’m annoyed and frustrated.
It’s best to avoid posting screenshots, as clearer and simpler to post your code.
Anyhow, the instructions are to :
print the result of comparing char with a space (' ' )
Your code :
char == ' '
print(char)
prints the current value of char, as set by each iteration of the for loop.
The first line should be inside the print call, to print the result of comparing char with a space (' ').
Hey @averywm070601 !
To my understanding you need to delete the last ‘print()’ call.
What you need to do as for the line under ‘for char in text.lower():’ is add something. I’ll give you a hint it starts with ‘pri’ and ends with ‘(…)’.
Also, a word of advise, next time, try to summarize what the instructions are telling you, you were likely just overthinking it. Don’t stress. It has negative impacts on coding.