I try differents things, and read lots of topics in the help forum. But cannot find what’s wrong here
Your code so far
# User Editable Region
for char in text.lower():
if char == ' ':
encrypted_text += char
index = alphabet.find(char)
new_index = (index + shift) % len(alphabet)
encrypted_text += alphabet[new_index]
print('Encrypted text:', encrypted_text)
# User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 42
alphabet = ‘abcdefghijklmnopqrstuvwxyz’ # Define the alphabet
shift = 3 # Example shift value
text = “hello world” # Example input text
encrypted_text = “” # Initialize the encrypted text
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. How to Help Someone with Their Code Using the Socratic Method
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.