Build a Caesar Cipher - Step 4

Tell us what’s happening:

It prints the correct answer with abcde at the end, but it says it’s wrong? Am I not meant to use the [start: end}?

Your code so far


# User Editable Region

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

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36

Challenge Information:

Build a Caesar Cipher - Step 4

https://www.freecodecamp.org/learn/full-stack-developer/workshop-caesar-cipher/step-4

what happens if shift changes? is your code going to work in that case?

you need to use the start:end syntax, but not hardcoding the value

1 Like

Thank you, I didn’t think about that, but I got it to work now. :+1: