Build a Caesar Cipher - Step 4

Tell us what’s happening:

my code’s output is correct but im still getting it wrong i think is the name of my final variable.

Your code so far


# User Editable Region

alphabet = 'abcdefghijklmnopqrstuvwxyz'
shift = 5
shifted_alphabet = alphabet[shift:]
print(shifted_alphabet)
concatenation = (shifted_alphabet) + (alphabet[:5])
print(concatenation)

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

Challenge Information:

Build a Caesar Cipher - Step 4

You’ve hard-coded your answer.

What if the shift variable changes?

Also, you should modify the line:

shifted_alphabet = 

Don’t add a new new line and definitely don’t create a new variable if you are not asked to.

Read your coment like 10 times and the instructions and finally got it ! thank you

1 Like

Awesome, glad you got it! The instructions often need a very careful reading.

I hope these principles will serve you well going forward though:

  • don’t hard code numbers when there’s a variable available.
  • If the instructions don’t say to create a new variable with a specific name, then you should avoid adding one. If you’re thinking of the name for a new variable, you know you probably shouldn’t add one
  • Determine if you should modify an existing line or add a new one

These decisions will come up often.

1 Like