Build a Caesar Cipher - Step 22

Tell us what’s happening:

Step 22
I implemented a Caesar cipher .it show me an error (encrypt not defined)
here is my code :

if not encrypt:
    shift = -shift

Your code so far


# User Editable Region

if not encrypt:
   shift =- shift

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like G

Challenge Information:

Build a Caesar Cipher - Step 22

This code is good and passes the test for me.

Is it possible you accidentally deleted the rest of the function? Can you see the function definition?

Try to reset the step and try again.

It should work, unless if you do not indent the code (since if not encrypt: is intended to be inside a function).

1 Like

Had the same issue, but turned out than i started typing code right after line “11”, so it considered the code to be outside caeser function, so it couldn’t pass. Maybe it could help somebody

removed

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.