Python is confusing cause I’ve done this thing countless times and it’s still not working
Your code so far
# User Editable Region
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
if char == ' ':
encrypted_text += char
else:
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/129.0.0.0 Safari/537.36 Edg/129.0.0.0
Challenge Information:
Learn String Manipulation by Building a Cipher - Step 43
yes you are right it’s confusing, at the start. I’m still learning with 0 code experience i started in july, firstly lets look at how the columns affect indentation, if you look at your if statement that’s the correct indentation after a column. Also for in the future tasks, it helps to look back at your code and compare. Let me know if you have any issues. Think it through, google it.
Look at the example again, and make sure your indentation is exactly the same.
Indentation is how Python knows if a block of code goes with a certain statement. Indentation is syntax, unlike JavaScript where indentation is more for style and easy reading and uses {curly braces} to indicate syntax and blocks of code.