Puffszy
November 23, 2025, 6:24am
1
Tell us what’s happening:
I’m struggling with this one so bad I don’t understand what I’m doing wrong
Your code so far
def caesar(text, shift):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
shifted_alphabet = alphabet[shift:] + alphabet[:shift]
# User Editable Region
translation_table = str.maketrans(str.upper(alphabet), str.upper(shifted_alphabet))
# User Editable Region
return text.translate(translation_table)
encrypted_text = caesar('freeCodeCamp', 3)
print(encrypted_text)
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
Challenge Information:
Build a Caesar Cipher - Step 15
ILM
November 23, 2025, 6:28am
2
you are using upper() in the wrong way, you need to str.upper() where str is the string you want to make uppercase
you also should not remove the lowercase version of the alphabet, instead you need to concatenate the two
1 Like
Teller
November 23, 2025, 6:28am
3
Welcome to the forum @Puffszy
Update your str.maketrans() call by concatenating to each argument the uppercase version of the argument itself.
Please reset the step to restore the seed code.
For each argument, concatenate the uppercase version of the argument.
Happy coding
1 Like
Puffszy
November 24, 2025, 3:39am
4
Thank you so much I appreciate it!
Puffszy
November 24, 2025, 3:40am
5
Thank you so much I appreciate it!!
1 Like
Continuing the discussion from Build a Caesar Cipher - Step 15 :
I am also on this step. However the solution you gave didn’t work for me. Please can you explain to me? Thank you very much.
ILM
November 29, 2025, 4:30pm
8
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.