Build a Caesar Cipher - Step 3

Tell us what’s happening:

Please i really help to kick my training on this..

Your code so far


# User Editable Region

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

# 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

Challenge Information:

Build a Caesar Cipher - Step 3

Try to focus on the wording of the directions.

“Create a variable named shifted_alphabet and use the slicing syntax to assign it the portion of alphabet that starts at the index of shift "

You already have shifted_alphabet- now assign it !

And then you will print out shifted_alphabet not fcc[8:].

shifted_alphabet = [b, 5]

print shifted_alphabet

i tried like this but it won’t pass too, please help

that would not work, what is b? you need to get a piece of alphabet

do i need to input more alphabets?

shifted_alphabet = [5]

alphabet[shift:5]

print (shifted_alphabet)

you already have one alphabet, that is enough

you need to get a piece of that and assign it to shifted_alphabet

here you are only assigning a list with 5 in it, not a piece of alphabet

Is this correction for my first question or after i edited it cos i’m lost…. what you highlighted was what i first posted for help

no, the code I quotes is from the last code you posted, not from the first

in the first code you posted you have only shifted_alphabet with no assignment, assigning something to it is an improvement, but you need to assign a piece of alphabet to it

see the example

fcc = 'freeCodeCamp'
print(fcc[8:]) # Camp

here fcc[8:] is a piece of fcc, considering that, how do you get a piece of alphabet?

alphabet = ‘abcdefghijklmnopqrstuvwxyz’

shift = 5

shifted_alphabet = ‘f’

print (alphabet[8:])

my current code

now, instead of assigning f, can you assign the piece of alphabet that you are printing here?

alphabet = ‘abcdefghijklmnopqrstuvwxyz’

shift = 5

shifted_alphabet = ‘fghijklmnopqrstuvwxyz’

print (alphabet[8:])

you need to use the slice syntax you are using inside print, do not write the alphabet directly

i have tried different ways, not getting it

Create a variable named shifted_alphabet and use the slicing syntax to assign it the portion of alphabet that starts at the index of shift

Check what you are assigning to the shifted_alphabet variable. Do the instructions ask to assign the string 'fghijklmnopqrstuvwxyz' ?

Then, call the built-in print() function to print shifted_alphabet

Are you printing the correct variable?

Use the slice syntax in the assignment, not the print. Don’t follow the example so much. It’s just an example of the slicing syntax.

Read the instructions, don’t rely on the example.

code pass.

removed by moderator call variable “alphabet” slicing “shift”

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.

removed by moderator

Too bad you missed the message just above this. It says:

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.

1 Like

You have to set your alphabet to shift or else it won’t do that.