Freecodecamp Python Certification (Build a Caesar Cipher step 4)

Can anyone help me with this code :

alphabet = ‘abcdefghijklmnopqrstuvwxyz’

shift = 5

shifted_alphabet = alphabet[shift:]

print(shifted_alphabet)

shifted_alphabet = alphabet[shift:]+alphabet[:shift]

print(shifted_alphabet)

and the actual output i’m getting is :

fghijklmnopqrstuvwxyz

fghijklmnopqrstuvwxyzabcde

The code i entered is actually working and giving the desired output for step-4 but i don’t know why it’s failing over and over

Tell us what’s happening:

Can anyone help me with this code :

alphabet = ‘abcdefghijklmnopqrstuvwxyz’

shift = 5

shifted_alphabet = alphabet[shift:]

print(shifted_alphabet)

shifted_alphabet = alphabet[shift:]+alphabet[:shift]

print(shifted_alphabet)

and the actual output i’m getting is :

fghijklmnopqrstuvwxyz

fghijklmnopqrstuvwxyzabcde

The code i entered is actually working and giving the desired output for step-4 but i don’t know why it’s failing over and over

Your code so far


# User Editable Region

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


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

Challenge Information:

Build a Caesar Cipher - Step 4

Welcome to the forum @ravimvgr

You are asked to modify the existing code, not to create new lines of code.

Happy coding

Hi @ravimvgr

I went ahead and combined your posts for you. In the future, just reply to the original thread to add further updates.

Thanks.