Tell us what’s happening:
Describe your issue in detail here.
i cant seem to understand what they are asking me to code
Your code so far
/* User Editable Region */
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
char == ' '
print = char
for char in text.lower():
index = alphabet.find(char)
new_index = index + shift
encrypted_text += alphabet[new_index]
print('char:', char, 'encrypted text:', encrypted_text)
/* 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/118.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 37
system
January 1, 2024, 4:26am
2
You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.
KTO
January 1, 2024, 4:45am
3
Hi there @simitsu ,
So it’s asking you to compare char == ' '
to an empty space which you have already done; it’s then asking you to print it as you’ve done in the past, but put it at the top of your loop.
print("Hello World!")
You don’t need to compare it in the top as print
will do that for you.
Hope you’ll find some use out of this. It’s hard to not spoil it because you’re quite close.
Good luck!
print(“char” == " ") i put this in and it gave me an answer of it being false but it says I’m wrong. i honestly dont know where the mistake is lol
KTO
January 1, 2024, 5:03am
5
You’ve got this!
So quotation marks are only used in a print function when you want to print text, is char text that you want to print?
print(“Hello World”)
print(1 + 1)
In this case print(“char” == " ")
char does not need quotations as it is not text that you want to print.
i get that and have removed the quotations but im still stuck lmaoo im so lost rn
i feel like I’ve tried everything but ik i haven’t and I’m still trying
KTO
January 1, 2024, 5:19am
7
Can you show what you’ve got now? Are you putting the print at the top of the loop?
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
print = (char == " ")
for char in text.lower():
index = alphabet.find(char)
new_index = index + shift
encrypted_text += alphabet[new_index]
print('char:', char, 'encrypted text:', encrypted_text)
KTO
January 1, 2024, 5:30am
9
I gotcha, print(char == " ")
needs to be in your loop, so that would fall just under your for char in text.lower():
Make sure that print function is correct and you should be set!
omg im soo slow bro but i thought that was the top of the loop was it not?
KTO
January 1, 2024, 5:36am
11
Hahaha, it was killing me to not say something about that to avoid spoiling it - glad you got it - I mean, you’re not wrong, it’s more above the loop than it is at the top of the loop
thank you so much I’m starting to understand the language of coders lol
1 Like
system
Closed
July 1, 2024, 5:40pm
13
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.