Hi everyone,
I’m currently working on Step 49 of the Caesar Cipher project on FreeCodeCamp.
I keep getting this error message:
“Your code has an indentation error. You may need to add pass on a new line to form a valid block of code.”
I tried using def and if as required, but it still doesn’t work.
Here’s my code:
def encrypt_text():
text = 'Hello World'
shift = 3
alphabet = 'abcdefghijklmnopqrstuvwxyz'
encrypted_text = ''
for char in text.lower():
if char == " ":
print("space!")
else:
index = alphabet.find(char)
new_index = index + shift
encrypted_text += alphabet[new_index]
print('char:', char, 'encrypted text:', encrypted_text)
encrypt_text()
Can someone please help me figure out what’s wrong?
Thank you!
