Tell us what’s happening:
Learning string manipulation by building a cipher - step 40
Your code so far
# User Editable Region
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
char == ('')
print(char == '')
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/124.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 40
1 Like
Please Tell us what’s happening in your own words.
Learning to describe problems is hard, but it is an important part of learning how to code.
Also, the more you say, the more we can help!
I am having a hard time getting the right code for the step 40.
I tried char == ’ ’
print(char == ’ ’ )
But i am still getting an error message
1 Like
print the result of comparing char with a space (' ')
These instructions only take 1 line. I’m not sure what the first line here is?
ILM
May 16, 2024, 9:06am
5
Blessed_Sam:
print(char == '')
'' is not a space, ' ' you need to have a proper space character between the quotes
5 Likes
SOLUTION REDACTED BY MODERATOR
ILM
May 16, 2024, 9:15am
7
hey @mseyidneali
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
Oh Alright.
Let me try that and revert back
I have tried it and still not progressing to the next task.
I am getting some printed results in the console but it still says my code does not pass.
Thank You @ILM
It worked.
I removed the first line and put a space between the colon.
2 Likes
system
Closed
November 15, 2024, 1:58am
11
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.