Tell us what’s happening:
I am not sure what this question is asking me to do. I know it wants me to compare [char] and set that equal to a blank quote so I have tried to add → char == (’ ‘) <-.
From there I tried to
print(’ ') and print(" ") and print (char)
when I plugged this into chatgpt this is the code it gave me
for char in text.lower():
# Check if the character is a space
is_space = char == ’ ’
print(‘char:’, char, ‘is space:’, is_space)
and the program still told me that this was incorrect.
# Perform other operations based on the challenge prompt
Your code so far
# User Editable Region
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
result = (char == ' ')
print(result)
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/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 41