Build a Caesar Cipher - Step 10

Tell us what’s happening:

Why is it considered wrong?
def caesar():
alphabet = “abcdefghijklmnopqrstuvwxyz”
message = “hello”
shift = 5

new_alphabet = alphabet[shift:] + alphabet[:shift]
encrypted = ""

for letter in message:
    index = alphabet.index(letter)
    encrypted += new_alphabet[index]

print(encrypted)

Your code so far


# User Editable Region

    def caesar():
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    message = "hello"
    shift = 5

    new_alphabet = alphabet[shift:] + alphabet[:shift]
    encrypted = ""

    for letter in message:
        index = alphabet.index(letter)
        encrypted += new_alphabet[index]

    print(encrypted)


# 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/142.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 10

Welcome to the forum @muhammadiyevshahriyo

See what you can take from the syntax error message in the console.

Happy coding

brother check the indentation, your def function and the code of your def function are on the same line, so you need to indent, meaning you need to press tab for all the code of the def function