Build a Caesar Cipher - Step 4

Tell us what’s happening:

im not getting here please can you give the example

Your code so far


# User Editable Region

alphabet = 'abcdefghijklmnopqrstuvwxyz'
shift = 5
shifted_alphabet = 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/142.0.0.0 Safari/537.36 Edg/142.0.0.0

Challenge Information:

Build a Caesar Cipher - Step 4

Hi

Here you need to work on the shifted_alphabet variable.

shifted_alphabet = alphabet[shift:]

It says you need to tack the removed part onto the end of the string using concatenation. The example shows you how to do this.

At present you can see that it displays the letters from f to the end by using [shift:]. (You have defined shift you mean position 5).

You use the same syntax to extract the first 5 letters. The example has [start:stop] - start and stop signify the positions in the alphabet string.

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

# Add the first 5 missing characters
sentence = alphabet[0:shift]
print(sentence) # abcde
full_sentence = shifted_alphabet + sentence
print(full_sentence)

Hey there, look what I’ve done.

  • I created a new variable to store the previously removed parts.
  • Then I created another variable full_sentence to add the missing part at the back of my alphabet.

This is correct, I think, but my submission doesn’t pass.

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge. This button only appears if you have tried to submit an answer at least three times.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.